diff --git a/lib/weblib.php b/lib/weblib.php index 1b52211d31a..a5fa724be4f 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -706,6 +706,8 @@ function choose_from_menu ($options, $name, $selected='', $nothing='choose', $sc */ function choose_from_radio ($options, $name, $checked='') { + static $idcounter = 0; + if (!$name) { $name = 'unnamed'; } @@ -715,15 +717,16 @@ function choose_from_radio ($options, $name, $checked='') { if (!empty($options)) { $currentradio = 0; foreach ($options as $value => $label) { - $output .= ' "; - $output .= '"; + $output .= '' . "\n"; + $output .= ' /> ' . "\n"; } else { - $output .= ' />'. $label .'' . "\n"; + $output .= ' /> ' . "\n"; } $currentradio = ($currentradio + 1) % 2; } @@ -744,6 +747,8 @@ function choose_from_radio ($options, $name, $checked='') { */ function print_checkbox ($name, $value, $checked = true, $label = '', $alt = '') { + static $idcounter = 0; + if (!$name) { $name = 'unnamed'; } @@ -756,9 +761,12 @@ function print_checkbox ($name, $value, $checked = true, $label = '', $alt = '') $strchecked = ' checked="checked"'; } + $htmlid = 'auto-cb'.sprintf('%04d', ++$idcounter); $output = '"; - $output .= ''; - $output .= $label; + $output .= ''; + if(!empty($label)) { + $output .= ' '; + } $output .= ''."\n"; echo $output;