]> saetta.ns0.it Git - zakform/cgi/commitdiff
Radio: didn't take into account if in error.
authorAndrea Zagli <azagli@libero.it>
Sat, 28 Nov 2020 08:28:49 +0000 (09:28 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 28 Nov 2020 08:28:49 +0000 (09:28 +0100)
src/formelementradio.c

index a91caf25b392845a0965a2daf2a37d5ee6ad92a0..a2812581b5cc42677d90a1210fe727533a054ab2 100644 (file)
@@ -282,6 +282,15 @@ gchar
                }
        else
                {
+                       GPtrArray *messages;
+
+                       messages = zak_form_element_get_messages (ZAK_FORM_ELEMENT (element));
+                       if (messages != NULL
+                           && messages->len > 0)
+                               {
+                                       g_hash_table_insert (ht_attrs_option, "class", g_strdup_printf ("%s is-invalid", g_hash_table_lookup (ht_attrs_option, "class")));
+                               }
+
                        g_hash_table_insert (ht_attrs_option, "class", g_strdup_printf ("%s form-check-input", g_hash_table_lookup (ht_attrs_option, "class")));
 
                        g_string_append_printf (ret, "\n<div class=\"form-check%s\">\n%s<label class=\"form-check-label\" for=\"%s_%d\">&nbsp;%s</label>\n</div>",