From: Andrea Zagli Date: Sat, 30 Jan 2016 08:55:14 +0000 (+0100) Subject: Adjustements from ZakForm. X-Git-Tag: v0.1.0~3^2~24 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=5df71fdb15c9071b4cf3ae10299e73b740579090;p=libzakcgi Adjustements from ZakForm. --- diff --git a/src/formelement.c b/src/formelement.c index 5e8d1fd..1198057 100644 --- a/src/formelement.c +++ b/src/formelement.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Andrea Zagli + * Copyright (C) 2015-2016 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -146,7 +146,7 @@ gchar str = g_string_new ("
get_messages (ZAK_FORM_ELEMENT (element)); + messages = zak_form_element_get_messages (ZAK_FORM_ELEMENT (element)); if (messages != NULL) { g_string_append (str, " has-error"); diff --git a/tests/form.c b/tests/form.c index 09c722a..9cb2fed 100644 --- a/tests/form.c +++ b/tests/form.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Andrea Zagli + * Copyright (C) 2015-2016 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -41,6 +41,8 @@ main (int argc, char *argv[]) ZakCgiForm *form; ZakCgiFormElement *element; + ZakFormElementValidator *validator; + zakcgimain = zak_cgi_main_new (); str = g_string_new ("\n" @@ -66,8 +68,9 @@ main (int argc, char *argv[]) zak_cgi_form_element_set_label (element, "The Label for first", NULL); zak_form_element_add_filter (ZAK_FORM_ELEMENT (element), ZAK_FORM_ELEMENT_FILTER (zak_form_element_filter_trim_new ())); - zak_form_element_add_validator (ZAK_FORM_ELEMENT (element), - ZAK_FORM_ELEMENT_VALIDATOR (zak_form_element_validator_regex_new ("^aaa$"))); + validator = zak_form_element_validator_regex_new (); + zak_form_element_validator_regex_set_regex (ZAK_FORM_ELEMENT_VALIDATOR_REGEX (validator), "^aaa$"); + zak_form_element_add_validator (ZAK_FORM_ELEMENT (element), validator); zak_form_form_add_element (ZAK_FORM_FORM (form), ZAK_FORM_ELEMENT (element)); element = zak_cgi_form_element_check_new_attrs ("chk", NULL);