]> saetta.ns0.it Git - zakform/tests/commitdiff
First test of cgi_ini save.
authorAndrea Zagli <azagli@libero.it>
Sun, 15 May 2016 09:45:23 +0000 (11:45 +0200)
committerAndrea Zagli <azagli@libero.it>
Sun, 15 May 2016 09:45:23 +0000 (11:45 +0200)
data/zakformtests/xml/cgi.xml
src/cgi_ini.c

index 81fa1cfe08d4dad940254d08733b8ddaef3709b7..a2bdede37dae8e8d0beb164f8e08da8d57cd1a85 100644 (file)
@@ -117,6 +117,8 @@ and                                  some            tabs
 
   <element type="zak_cgi_form_element_submit">
        <id>submit</id>
+       <to-load>FALSE</to-load>
+       <to-save>FALSE</to-save>
        <zak-cgi-content>Submit</zak-cgi-content>
   </element>
 
index b0d35e24033b8c6c520611d4ef3f7b99376caaeb..8c30eda0da39f2987f1bf959be70b90e550e85f8 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <libzakcgi/libzakcgi.h>
 #include <libzakform/libzakform.h>
+#include <libzakformini/libzakformini.h>
 
 int
 main (int argc, char *argv[])
@@ -36,7 +37,8 @@ main (int argc, char *argv[])
        gchar *filename;
 
        ZakCgiForm *form;
-       ZakCgiFormElement *element;
+
+       ZakFormIniProvider *provider;
 
        zakcgimain = zak_cgi_main_new ();
 
@@ -71,6 +73,12 @@ main (int argc, char *argv[])
                                        if (zak_form_form_is_valid (ZAK_FORM_FORM (form)))
                                                {
                                                        g_string_append (str, "<div class=\"alert alert-success\" role=\"alert\">Form is valid!!!</div>");
+                                                       provider = zak_form_ini_provider_new_from_file (filename);
+                                                       if (provider != NULL)
+                                                               {
+                                                                       zak_form_form_insert (ZAK_FORM_FORM (form), ZAK_FORM_IPROVIDER (provider));
+                                                                       g_object_unref (provider);
+                                                               }
                                                }
                                        else
                                                {