Merge branch 'MDL-30940-master' of git://github.com/FMCorz/moodle

This commit is contained in:
Damyon Wiese 2013-04-29 14:03:34 +08:00
commit ea03f1149e

View File

@ -71,13 +71,19 @@ class MoodleQuickForm_select extends HTML_QuickForm_select{
* @return string
*/
function toHtml(){
$html = '';
if ($this->getMultiple()) {
// Adding an hidden field forces the browser to send an empty data even though the user did not
// select any element. This value will be cleaned up in self::exportValue() as it will not be part
// of the select options.
$html .= '<input type="hidden" name="'.$this->getName().'" value="_qf__force_multiselect_submission">';
}
if ($this->_hiddenLabel){
$this->_generateId();
return '<label class="accesshide" for="'.$this->getAttribute('id').'" >'.
$this->getLabel().'</label>'.parent::toHtml();
} else {
return parent::toHtml();
$html .= '<label class="accesshide" for="'.$this->getAttribute('id').'" >'.$this->getLabel().'</label>';
}
$html .= parent::toHtml();
return $html;
}
/**