Skip to content

Commit

Permalink
Merge branch 'MDL-30940-23' of git://github.com/FMCorz/moodle into MO…
Browse files Browse the repository at this point in the history
…ODLE_23_STABLE
  • Loading branch information
Damyon Wiese committed Apr 29, 2013
2 parents 018e8a9 + 50a40ae commit 70f7ea9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/form/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,19 @@ function setHiddenLabel($hiddenLabel){
* @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;
}

/**
Expand Down

0 comments on commit 70f7ea9

Please sign in to comment.