now wrapping a group element in a fieldset tag, brought id tag on checkboxes and radio boxes in line with moodle universal form structure

This commit is contained in:
jamiesensei 2006-09-28 04:18:35 +00:00
parent f5896f0fb6
commit ec929cd596
3 changed files with 37 additions and 1 deletions

View File

@ -41,5 +41,23 @@ class moodleform_checkbox extends HTML_QuickForm_checkbox{
function getHelpButton(){
return $this->_helpbutton;
}
/**
* Automatically generates and assigns an 'id' attribute for the element.
*
* Currently used to ensure that labels work on radio buttons and
* checkboxes. Per idea of Alexander Radivanovich.
* Overriden in moodleforms to remove qf_ prefix.
*
* @access private
* @return void
*/
function _generateId()
{
static $idx = 1;
if (!$this->getAttribute('id')) {
$this->updateAttributes(array('id' => substr(md5(microtime() . $idx++), 0, 6)));
}
} // end func _generateId
}
?>

View File

@ -17,7 +17,7 @@ class moodleform_group extends HTML_QuickForm_group{
* @var string
*/
var $_helpbutton='';
var $_elementTemplateType='default';
var $_elementTemplateType='fieldset';
//would cause problems with client side validation so will leave for now
//var $_elementTemplateType='fieldset';
/**

View File

@ -41,5 +41,23 @@ class moodleform_radio extends HTML_QuickForm_radio{
function getHelpButton(){
return $this->_helpbutton;
}
/**
* Automatically generates and assigns an 'id' attribute for the element.
*
* Currently used to ensure that labels work on radio buttons and
* checkboxes. Per idea of Alexander Radivanovich.
* Overriden in moodleforms to remove qf_ prefix.
*
* @access private
* @return void
*/
function _generateId()
{
static $idx = 1;
if (!$this->getAttribute('id')) {
$this->updateAttributes(array('id' => substr(md5(microtime() . $idx++), 0, 6)));
}
} // end func _generateId
}
?>