MDL-23486 ugly ugly ugly hack - hardcoded required text checking in editor element; we should realy create new forms engine in 2.1 :-(

This commit is contained in:
Petr Skoda 2010-07-23 18:31:31 +00:00
parent eea0c8eaa7
commit a5e94d4bb3
2 changed files with 7 additions and 0 deletions

View File

@ -1502,6 +1502,11 @@ class HTML_QuickForm extends HTML_Common {
$values[] = $this->getSubmitValue($elName);
}
$result = $registry->validate($rule['type'], $values, $rule['format'], true);
} else if ($rule['type'] === 'required' and $this->getElement($target)->_type === 'editor') {
//horrible horrible hack
if (!isset($submitValue['text']) or $submitValue['text'] === '') {
$result = false;
}
} elseif (is_array($submitValue) && !isset($rule['howmany'])) {
$result = $registry->validate($rule['type'], $submitValue, $rule['format'], true);
} else {

View File

@ -22,6 +22,8 @@ and documented for Moodle at:
4/ MDL-20876 - replaced deprecated split() with explode() or str_split() where appropriate
5/ hardcoded editor element required rule validation
Such modifications should be carefully each time the Excel PEAR package is updated
to a new release within Moodle.