MDL-30843 and MDL-30842 - accessibility compliance: Add <label> for form input text and select tag

This commit is contained in:
Rossiani Wijaya
2012-03-30 16:26:58 +08:00
parent c856a1f60b
commit f9f281b8fe
108 changed files with 390 additions and 216 deletions
+3 -3
View File
@@ -2525,12 +2525,12 @@ function print_textfield($name, $value, $alt = '', $size=50, $maxlength=0, $retu
}
$style = "width: {$size}px;";
$attributes = array('type'=>'text', 'name'=>$name, 'alt'=>$alt, 'style'=>$style, 'value'=>$value);
$attributes = array('type' => 'text', 'id' => $name, 'name' => $name, 'alt' => $alt, 'style' => $style, 'value' => $value);
if ($maxlength) {
$attributes['maxlength'] = $maxlength;
}
$output = html_writer::empty_tag('input', $attributes);
$output = html_writer::label($name, $name, false, array('class' => 'accesshide'));
$output .= html_writer::empty_tag('input', $attributes);
if (empty($return)) {
echo $output;