]> saetta.ns0.it Git - zakform/tests/commitdiff
Start test cgi js validation.
authorAndrea Zagli <azagli@libero.it>
Mon, 20 Jul 2020 07:21:46 +0000 (09:21 +0200)
committerAndrea Zagli <azagli@libero.it>
Mon, 20 Jul 2020 07:21:46 +0000 (09:21 +0200)
src/cgi.js [new file with mode: 0644]
src/cgi_ini_b4.c

diff --git a/src/cgi.js b/src/cgi.js
new file mode 100644 (file)
index 0000000..970dd3c
--- /dev/null
@@ -0,0 +1,16 @@
+function click_add ()
+{
+       alert ("add");
+
+       $("#spanName").remove();
+       $("#name").addClass("is-invalid");
+       $("#name").parent().append("<span id=\"spanName\" class=\"invalid-feedback\">pippolo</span>");
+}
+
+function click_remove ()
+{
+       alert ("remove");
+
+       $("#name").removeClass("is-invalid");
+       $("#spanName").remove();
+}
index 91a8d642ad8a04bc3290e9ec45dfebd4e108ce28..ff8fd71798a6e38518b46cd2fa93bfefb649d7a1 100644 (file)
@@ -57,7 +57,9 @@ main (int argc, char *argv[])
                            "<link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css\">\n"
                            "</head>\n"
                            "<body>\n"
-                           "<div class=\"container\">\n");
+                           "<div class=\"container\">\n"
+                           "<button type=\"button\" class=\"btn btn-primary\" onclick=\"click_add();\">Add</button>\n"
+                           "<button type=\"button\" class=\"btn btn-primary\" onclick=\"click_remove();\">Remove</button>\n");
 
        val = zak_cgi_main_get_parameter (zakcgimain, "filename");
        if (val != NULL)
@@ -149,6 +151,7 @@ main (int argc, char *argv[])
                         "<script src=\"https://code.jquery.com/jquery-3.5.1.slim.min.js\"></script>\n"
                         "<script src=\"https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js\"></script>\n"
                         "<script src=\"https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js\"></script>\n"
+                        "<script src=\"cgi.js\"></script>\n"
                         "</body>\n"
                         "</html>");