Skip to content

Commit

Permalink
applying the same patch to advcheckbox - Fixes MDL-8627, "HTML QuickF…
Browse files Browse the repository at this point in the history
…orm displays (some?) disabled elements in a non-accessible way", overrides parent::getFrozenHtml.
  • Loading branch information
skodak committed Sep 15, 2007
1 parent e193724 commit 43c137a
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions lib/form/advcheckbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,28 @@ function _generateId()
$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

}
?>

0 comments on commit 43c137a

Please sign in to comment.