--- /dev/null
+<?xml version="1.0"?>
+<zakform>
+
+ <element type="zak_cgi_form_element_text">
+ <id>id</id>
+ <type>integer</type>
+ <is-key>TRUE</is-key>
+ <to-load>FALSE</to-load>
+ <label>The label for first</label>
+ <filter type="zak_form_element_filter_trim"></filter>
+ </element>
+
+ <!-- <element type="zak_cgi_form_element_label"> -->
+ <!-- <name>id</id> -->
+ <!-- <type>integer</type> -->
+ <!-- <to-save>FALSE</to-save> -->
+ <!-- <default-value>1999</default-value> -->
+ <!-- <format thousands_separator="" /> -->
+ <!-- <widget>lbl_id</widget> -->
+ <!-- <label>label8</label> -->
+ <!-- </element> -->
+
+ <element type="zak_cgi_form_element_text">
+ <id>name</id>
+ <type>string</type>
+ <default-value>John Doe</default-value>
+ <label>Name</label>
+ <filter type="zak_form_element_filter_trim"></filter>
+ <filter type="zak_form_element_filter_luc">camel</filter>
+ <validator type="zak_form_element_validator_notempty"></validator>
+ </element>
+
+ <element type="zak_cgi_form_element_text">
+ <id>age</id>
+ <type>integer</type>
+ <default-value>33</default-value>
+ <format thousands_separator="" decimals="0" />
+ <label>Age</label>
+ <validator type="zak_form_element_validator_notempty">0</validator>
+ </element>
+
+ <element type="zak_cgi_form_element_check">
+ <id>married</id>
+ <type>boolean</type>
+ <default-value>TRUE</default-value>
+ <label>Married</label>
+ </element>
+
+ <element type="zak_cgi_form_element_text_area">
+ <id>description</id>
+ <type>string</type>
+ <default-value>dafault value for textview
+with line break
+and some tabs
+ and ' ' ' ' ' ' ' ' ?? ? ? ? ?? * * * * </default-value>
+ <label>Description</label>
+ </element>
+
+ <element type="zak_cgi_form_element_text">
+ <id>birthday</id>
+ <type>datetime</type>
+ <default-value>@now</default-value>
+ <format>%d/%m/%Y</format>
+ <label>Birthday</label>
+ <validator type="zak_form_element_validator_date">%d/%m/%Y</validator>
+ </element>
+
+ <!-- <element type="zak_cgi_form_element_radio"> -->
+ <!-- <id>sex</id> -->
+ <!-- <type>string</type> -->
+ <!-- <default-value>M</default-value> -->
+ <!-- <widget>rbtnNone</widget> -->
+ <!-- <label>label3</label> -->
+ <!-- <return-value></return-value> -->
+ <!-- </element> -->
+
+ <!-- <element type="zak_cgi_form_element_radio"> -->
+ <!-- <id>sex</id> -->
+ <!-- <type>string</type> -->
+ <!-- <default-value>M</default-value> -->
+ <!-- <widget>rbtnMale</widget> -->
+ <!-- <label>label3</label> -->
+ <!-- <return-value>M</return-value> -->
+ <!-- </element> -->
+
+ <!-- <element type="zak_cgi_form_element_radio"> -->
+ <!-- <id>sex</id> -->
+ <!-- <type>string</type> -->
+ <!-- <default-value>M</default-value> -->
+ <!-- <widget>rbtnFemale</widget> -->
+ <!-- <label>label3</label> -->
+ <!-- <return-value>F</return-value> -->
+ <!-- </element> -->
+
+ <element type="zak_cgi_form_element_text">
+ <id>income</id>
+ <type>float</type>
+ <format currency_symbol="" decimals="3" thousands_separator="-" />
+ <label>Income</label>
+ </element>
+
+ <element type="zak_cgi_form_element_text">
+ <id>date_from</id>
+ <type>datetime</type>
+ <format>%d/%m/%Y</format>
+ <widget>entry2</widget>
+ <label>Date from</label>
+ <validator type="zak_form_element_validator_date">%d/%m/%Y</validator>
+ </element>
+
+ <element type="zak_cgi_form_element_text">
+ <id>date_to</id>
+ <type>datetime</type>
+ <format>%d/%m/%Y</format>
+ <label>Date to</label>
+ <validator type="zak_form_element_validator_date">%d/%m/%Y</validator>
+ </element>
+
+ <element type="zak_cgi_form_element_submit">
+ <id>submit</id>
+ <zak-cgi-content>Submit</zak-cgi-content>
+ </element>
+
+ <validator type="zak_form_validator_compare_date" type_comp="lt" element1="date_from" format1="%d/%m/%Y" element2="date_to" format2="%d/%m/%Y"></validator>
+
+</zakform>
--- /dev/null
+/*
+ * Copyright (C) 2016 Andrea Zagli <azagli@libero.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include <config.h>
+#endif
+
+#include <unistd.h>
+
+#include <libzakcgi/libzakcgi.h>
+#include <libzakform/libzakform.h>
+
+int
+main (int argc, char *argv[])
+{
+ ZakCgiMain *zakcgimain;
+
+ GString *str;
+
+ GValue *val;
+ gchar *filename;
+
+ ZakCgiForm *form;
+ ZakCgiFormElement *element;
+
+ zakcgimain = zak_cgi_main_new ();
+
+ str = g_string_new ("<!DOCTYPE html>\n"
+ "<html lang=\"it\">\n"
+ "<head>\n"
+ "<meta charset=\"utf-8\">\n"
+ "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n"
+ "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n"
+ "<title>Form test</title>\n"
+ "<!-- Bootstrap -->\n"
+ "<!-- Latest compiled and minified CSS -->\n"
+ "<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\">\n"
+ "</head>\n"
+ "<body>\n"
+ "<div class=\"container\">\n");
+
+ val = zak_cgi_main_get_parameter (zakcgimain, "filename");
+ filename = (gchar *)g_value_get_string (val);
+
+ form = zak_cgi_form_new (zakcgimain,
+ "method", "post",
+ "action", g_strdup_printf ("cgi_ini?filename=%s", filename),
+ NULL);
+
+ if (zak_form_form_load_from_file (ZAK_FORM_FORM (form), XMLDIR "/cgi.xml"))
+ {
+ if (zak_cgi_main_is_post (zakcgimain))
+ {
+ /* validating the form */
+ zak_cgi_form_bind (form);
+ if (zak_form_form_is_valid (ZAK_FORM_FORM (form)))
+ {
+ g_string_append (str, "Form is valid!!!");
+ }
+ else
+ {
+ g_string_append (str, zak_cgi_form_render (form));
+ g_string_append (str, "Form is not valid!!!");
+ }
+ }
+ else
+ {
+ g_string_append (str, zak_cgi_form_render (form));
+ }
+ }
+
+ g_string_append (str,
+ "\n</div>\n"
+ "<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->\n"
+ "<script src=\"http://code.jquery.com/jquery-1.11.3.min.js\"></script>\n"
+ "<!-- Include all compiled plugins (below), or include individual files as needed -->\n"
+ "<!-- Latest compiled and minified JavaScript -->\n"
+ "<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>\n"
+ "</body>\n"
+ "</html>");
+
+ zak_cgi_main_out (NULL, str->str);
+
+ return 0;
+}