]> saetta.ns0.it Git - zakform/cgi/commitdiff
Added property «for» for radio/check labels on Bootstrap v4.
authorAndrea Zagli <azagli@libero.it>
Wed, 1 Jul 2020 13:44:24 +0000 (15:44 +0200)
committerAndrea Zagli <azagli@libero.it>
Wed, 1 Jul 2020 13:44:24 +0000 (15:44 +0200)
src/formelementcheck.c
src/formelementradio.c

index 770a29234274fcba19ce81655ae93c5319db3712..beb3caef32e4141cf858ddfeb1d9bc05bca44c38 100644 (file)
@@ -279,8 +279,9 @@ static gchar
                {
                        g_hash_table_insert (ht_attrs, "class", g_strdup_printf ("%s form-check-input", g_hash_table_lookup (ht_attrs, "class")));
 
-                       g_string_append_printf (str, "\n%s<label class=\"form-check-label\">%s</label>",
+                       g_string_append_printf (str, "\n%s<label class=\"form-check-label\" for=\"%s\">%s</label>",
                                                zak_cgi_tag_tag_ht ("input", zak_form_cgi_form_element_get_id (element), ht_attrs),
+                                               zak_form_cgi_form_element_get_id (element),
                                                zak_form_cgi_form_element_check_get_text (ZAK_FORM_CGI_FORM_ELEMENT_CHECK (element)));
                }
 
index 310b57442428a3ec226592ef232fcd8e68b7100b..c1704c07fac8c06c5c5dc22c6b91160555f33eb5 100644 (file)
@@ -293,12 +293,14 @@ gchar
                {
                        /* 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%s<label class=\"form-check-label\">&nbsp;%s</label>",
+                       g_string_append_printf (ret, "\n%s<label class=\"form-check-label\" for=\"%s_%d\">&nbsp;%s</label>",
                                                zak_cgi_tag_tag_ht ("input",
                                                                    g_strdup_printf ("%s_%d",
                                                                                     zak_form_cgi_form_element_get_id (element),
                                                                                     idx + 1),
                                                                    ht_attrs_option),
+                                               zak_form_cgi_form_element_get_id (element),
+                                               idx + 1,
                                                opt->content);
                }