diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-09-11 17:23:58 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-09-11 17:23:58 +0000 |
commit | 5030ea40a51b0d6527f5d43519cdbf0a3cca0c56 (patch) | |
tree | 4804a68c60f275b1dbd8d50d99651c8f9b72164f | |
parent | ac7637bc9bf5c4dae43a448511b67daf2825be1a (diff) | |
download | brdo-5030ea40a51b0d6527f5d43519cdbf0a3cca0c56.tar.gz brdo-5030ea40a51b0d6527f5d43519cdbf0a3cca0c56.tar.bz2 |
#150851 by pwolanin and chx: different radio buttons in the same set should have different HTML id values (XHTML validity fix)
-rw-r--r-- | includes/form.inc | 4 | ||||
-rw-r--r-- | modules/filter/filter.module | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/includes/form.inc b/includes/form.inc index 4dcd14391..74d8f54b1 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -1548,6 +1548,9 @@ function expand_radios($element) { if (count($element['#options']) > 0) { foreach ($element['#options'] as $key => $choice) { if (!isset($element[$key])) { + // Generate the parents as the autogenerator does, so we will have a + // unique id for each radio button. + $parents_for_id = array_merge($element['#parents'], array($key)); $element[$key] = array( '#type' => 'radio', '#title' => $choice, @@ -1555,6 +1558,7 @@ function expand_radios($element) { '#default_value' => isset($element['#default_value']) ? $element['#default_value'] : NULL, '#attributes' => $element['#attributes'], '#parents' => $element['#parents'], + '#id' => form_clean_id('edit-'. implode('-', $parents_for_id)), ); } } diff --git a/modules/filter/filter.module b/modules/filter/filter.module index c3d07c661..a37bf91ee 100644 --- a/modules/filter/filter.module +++ b/modules/filter/filter.module @@ -794,6 +794,9 @@ function filter_form($value = FILTER_FORMAT_DEFAULT, $weight = NULL, $parents = ); // Multiple formats available: display radio buttons with tips. foreach ($formats as $format) { + // Generate the parents as the autogenerator does, so we will have a + // unique id for each radio button. + $parents_for_id = array_merge($parents, array($format->format)); $form[$format->format] = array( '#type' => 'radio', '#title' => $format->name, @@ -801,6 +804,7 @@ function filter_form($value = FILTER_FORMAT_DEFAULT, $weight = NULL, $parents = '#return_value' => $format->format, '#parents' => $parents, '#description' => theme('filter_tips', _filter_tips($format->format, FALSE)), + '#id' => form_clean_id('edit-'. implode('-', $parents_for_id)), ); } } |