From 09ef8d60366a2ea03f174ee1bd2312cdeaaad408 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sat, 14 May 2016 10:39:06 +0200 Subject: [PATCH] Cgi: tested form validators (with messages). --- src/cgi_ini.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/cgi_ini.c b/src/cgi_ini.c index 8c04a94..b0d35e2 100644 --- a/src/cgi_ini.c +++ b/src/cgi_ini.c @@ -70,12 +70,30 @@ main (int argc, char *argv[]) zak_cgi_form_bind (form); if (zak_form_form_is_valid (ZAK_FORM_FORM (form))) { - g_string_append (str, "Form is valid!!!"); + g_string_append (str, "
Form is valid!!!
"); } else { + g_string_append (str, "
Form is not valid!!!"); + + guint m; + GPtrArray *ar_messages = zak_form_form_get_messages (ZAK_FORM_FORM (form)); + if (ar_messages != NULL) + { + if (ar_messages->len > 0) + { + g_string_append (str, "\n\n"); + } + } + + g_string_append (str, "
"); + g_string_append (str, zak_cgi_form_render (form)); - g_string_append (str, "Form is not valid!!!"); } } else -- 2.49.0