MDL-30909 Forms: Custom ID can be set on a form

This commit is contained in:
Frederic Massart 2012-09-13 14:48:01 +08:00
parent c8ac480979
commit 28c7749fc7

View File

@ -1301,13 +1301,15 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
} else {
$this->_pageparams = '';
}
//no 'name' atttribute for form in xhtml strict :
$attributes = array('action'=>$action, 'method'=>$method,
'accept-charset'=>'utf-8', 'id'=>'mform'.$formcounter) + $target;
// No 'name' atttribute for form in xhtml strict :
$attributes = array('action' => $action, 'method' => $method, 'accept-charset' => 'utf-8') + $target;
if (is_null($this->getAttribute('id'))) {
$attributes['id'] = 'mform' . $formcounter;
}
$formcounter++;
$this->updateAttributes($attributes);
//this is custom stuff for Moodle :
// This is custom stuff for Moodle :
$oldclass= $this->getAttribute('class');
if (!empty($oldclass)){
$this->updateAttributes(array('class'=>$oldclass.' mform'));