applying the same patch to advcheckbox - Fixes MDL-8627, "HTML QuickForm displays (some?) disabled elements in a non-accessible way", overrides parent::getFrozenHtml.

This commit is contained in:
skodak 2007-09-15 19:43:01 +00:00
parent e193724e38
commit 43c137ac23

View File

@ -88,23 +88,28 @@ class MoodleQuickForm_advcheckbox extends HTML_QuickForm_advcheckbox{
$this->updateAttributes(array('id' => 'id_'.substr(md5(microtime() . $idx++), 0, 6)));
}
} // end func _generateId
/**
* Slightly different container template when frozen. Don't want to use a label tag
* with a for attribute in that case for the element label but instead use a div.
* Templates are defined in renderer constructor.
*
* @return string
*/
function getElementTemplateType(){
if ($this->_flagFrozen){
return 'static';
} else {
return 'default';
}
}
function toHtml()
{
return '<span>' . parent::toHtml() . '</span>';
}
/**
* Returns the disabled field. Accessibility: the return "[ ]" from parent
* class is not acceptable for screenreader users, and we DO want a label.
* @return string
*/
function getFrozenHtml()
{
//$this->_generateId();
$output = '<input type="checkbox" disabled="disabled" id="'.$this->getAttribute('id').'" ';
if ($this->getChecked()) {
$output .= 'checked="checked" />'.$this->_getPersistantData();
} else {
$output .= '/>';
}
return $output;
} //end func getFrozenHtml
}
?>