-
Improvement
-
Resolution: Won't Do
-
Major
-
None
-
1.9, 3.0
-
MOODLE_19_STABLE, MOODLE_30_STABLE
In the file
{moodesite}/lib/pear/HTML/QuickForm/checkbox.php there is a problem in the definition.
function HTML_QuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null)
|
{
|
HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
|
$this->_persistantFreeze = true;
|
$this->_text = $text;
|
$this->setType('checkbox');
|
$this->updateAttributes(array('value'=>1));
|
$this->_generateId();
|
} //end constructor
|
As you see, the value is always set to 1 no matter what developer sets in the addElement function.
I think you need to check to see if a value if given. If one is given, no need to set the value =1.
For example,
function HTML_QuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null)
|
{
|
HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
|
$this->_persistantFreeze = true;
|
$this->_text = $text;
|
$this->setType('checkbox');
|
if (!isset($this->_attributes['value']) ) {
|
$this->updateAttributes(array('value'=>1));
|
}
|
$this->_generateId();
|
} //end constructor
|
This way, the value is only set to 1 if no value is given.