]> saetta.ns0.it Git - zakform/libzakform/commitdiff
On Composite validator, set_error only for elements not in condition tree elements.
authorAndrea Zagli <azagli@libero.it>
Sat, 9 Jan 2021 07:37:43 +0000 (08:37 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 9 Jan 2021 07:37:43 +0000 (08:37 +0100)
src/formvalidatorcomposite.c

index fd7b2dfe78040b4681c3b6fa004d0f48c05bf8c5..3401a8c0dbb79c0f9fc3bb200c40fabc8893c784 100644 (file)
@@ -234,6 +234,8 @@ _zak_form_validator_composite_xml_parsing (ZakFormValidator *validator, xmlNode
                                        n = (Node *)g_new0 (Node, 1);
                                        n->valid = TRUE;
 
+                                       n->condition = FALSE;
+
                                        if (xmlStrEqual (xmlGetProp (cur, (xmlChar *)"type"), (xmlChar *)"and"))
                                                {
                                                        n->logic_type = LOGIC_TYPE_AND;
@@ -272,6 +274,8 @@ _zak_form_validator_composite_xml_parsing (ZakFormValidator *validator, xmlNode
                                        n = (Node *)g_new0 (Node, 1);
                                        n->valid = TRUE;
 
+                                       n->condition = FALSE;
+
                                        if (g_strcmp0 ((gchar *)xmlGetProp (cur, (xmlChar *)"validator_type"), "form") == 0)
                                                {
                                                        ZakFormValidatorConstructorFunc validator_constructor;
@@ -576,7 +580,8 @@ _zak_form_validator_composite_set_elements_message (ZakFormValidator *validator,
 
                        if (!n_child->valid)
                                {
-                                       if (n_child->form_validator == NULL
+                                       if (!n_child->condition
+                                           && n_child->form_validator == NULL
                                            && n_child->element_validator != NULL
                                            && n_child->element != NULL)
                                                {