From 3e51b0ad7ee27bee894798fdba4f1c1de276390a Mon Sep 17 00:00:00 2001 From: David Monllao Date: Thu, 28 Jan 2016 08:54:10 +0800 Subject: [PATCH] MDL-52826 forms: Using id attr Switch from custom id references to the element's id attribute. Extra fix to get rid of an unnecessary call to getValidationScript(). --- lib/formslib.php | 4 ++-- lib/pear/HTML/QuickForm/DHTMLRulesTableless.php | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/formslib.php b/lib/formslib.php index 27bbae763f7..a616133d5d0 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -2259,10 +2259,10 @@ var skipClientValidation = false; } } - document.getElementById(\'id_' . $elementName . '\').addEventListener(\'blur\', function(ev) { + document.getElementById(\'' . $element->_attributes['id'] . '\').addEventListener(\'blur\', function(ev) { ' . $valFunc . ' }); - document.getElementById(\'id_' . $elementName . '\').addEventListener(\'change\', function(ev) { + document.getElementById(\'' . $element->_attributes['id'] . '\').addEventListener(\'change\', function(ev) { ' . $valFunc . ' }); '; diff --git a/lib/pear/HTML/QuickForm/DHTMLRulesTableless.php b/lib/pear/HTML/QuickForm/DHTMLRulesTableless.php index cf89eadb269..cc0e4ee4bf0 100644 --- a/lib/pear/HTML/QuickForm/DHTMLRulesTableless.php +++ b/lib/pear/HTML/QuickForm/DHTMLRulesTableless.php @@ -198,11 +198,6 @@ function validate_' . $this->_attributes['id'] . '(frm) { } // end func getValidationScript // }}} - - function display() { - $this->getValidationScript(); - return parent::display(); - } } -?> \ No newline at end of file +?>