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, "<div class=\"alert alert-success\" role=\"alert\">Form is valid!!!</div>");
}
else
{
+ g_string_append (str, "<div class=\"alert alert-danger\" role=\"alert\">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<ul>\n");
+ for (m = 0; m < ar_messages->len; m++)
+ {
+ g_string_append_printf (str, "\n<li>%s</li>", (gchar *)g_ptr_array_index (ar_messages, m));
+ }
+ g_string_append (str, "\n</ul>\n");
+ }
+ }
+
+ g_string_append (str, "</div>");
+
g_string_append (str, zak_cgi_form_render (form));
- g_string_append (str, "Form is not valid!!!");
}
}
else