Permalink
Browse files

MDL-11318 formslib now respects a template for an element if it is se…

…t. But since formslib uses the templates to insert help buttons for setAdvanced functionality etc. if you use templates you will lose this functionality.
  • Loading branch information...
jamiesensei
jamiesensei committed Sep 18, 2007
1 parent 5d27c22 commit 0b58276ad03e949d81e6cef0334c97b6b9984b24
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/formslib.php
View
@@ -545,11 +545,11 @@ function add_action_buttons($cancel = true, $submitlabel=null){
$buttonarray[] = &$mform->createElement('submit', 'submitbutton', $submitlabel);
$buttonarray[] = &$mform->createElement('cancel');
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
- $mform->closeHeaderBefore('buttonar');
+ $mform->closeHeaderBefore('buttonar');
} else {
//no group needed
$mform->addElement('submit', 'submitbutton', $submitlabel);
- $mform->closeHeaderBefore('submitbutton');
+ $mform->closeHeaderBefore('submitbutton');
}
}
}
@@ -1133,7 +1133,7 @@ function validate_' . $this->_formName . '_' . $elementName . '(element) {
frm.elements[\''.$elementName.'\'].focus();
}
';
-
+
// Fix for bug displaying errors for elements in a group
//unset($element);
//$element =& $this->getElement($elementName);
@@ -1151,7 +1151,7 @@ function validate_' . $this->_formName . '(frm) {
return true;
}
var ret = true;
-
+
var frm = document.getElementById(\''. $this->_attributes['id'] .'\')
var first_focus = false;
' . $validateJS . ';
@@ -1506,7 +1506,9 @@ function renderElement(&$element, $required, $error){
}
- $this->_templates[$element->getName()] = $html;
+ if (!isset($this->_templates[$element->getName()])) {
+ $this->_templates[$element->getName()] = $html;
+ }
parent::renderElement($element, $required, $error);
}

0 comments on commit 0b58276

Please sign in to comment.