mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
Revert "MDL-38555 forms: Prevent same data submission multiple times."
This reverts commit 761670208a97c0ed7e1ff7c2e6a7ec5494eb93d3.
This commit is contained in:
parent
9d109ad60d
commit
80b3780a53
@ -1,9 +0,0 @@
|
||||
M.form_submit = {};
|
||||
|
||||
M.form_submit.init = function(Y, options) {
|
||||
Y.on('submit', function(e) {
|
||||
if (!containsErrors) {
|
||||
e.target.one('#'+options.submitid).setAttribute('disabled', 'true');
|
||||
}
|
||||
}, '#'+options.formid);
|
||||
};
|
@ -38,9 +38,6 @@ require_once("HTML/QuickForm/submit.php");
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class MoodleQuickForm_submit extends HTML_QuickForm_submit {
|
||||
/** @var string Need to store id of form for submission control in JS*/
|
||||
var $_formid = '';
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
@ -63,7 +60,6 @@ class MoodleQuickForm_submit extends HTML_QuickForm_submit {
|
||||
{
|
||||
switch ($event) {
|
||||
case 'createElement':
|
||||
$this->_formid = $caller->getAttribute('id');
|
||||
parent::onQuickFormEvent($event, $arg, $caller);
|
||||
if ($caller->isNoSubmitButton($arg[0])){
|
||||
//need this to bypass client validation
|
||||
@ -102,22 +98,4 @@ class MoodleQuickForm_submit extends HTML_QuickForm_submit {
|
||||
$this->_flagFrozen = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML for this form element.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function toHtml(){
|
||||
global $PAGE;
|
||||
$options = array(
|
||||
'submitid' => $this->getAttribute('id'),
|
||||
'formid' => $this->_formid,
|
||||
);
|
||||
$str = parent::toHtml();
|
||||
if ($this->getAttribute('onclick') === null) {
|
||||
$module = array('name'=>'form_submit', 'fullpath'=>'/lib/form/submit.js');
|
||||
$PAGE->requires->js_init_call('M.form_submit.init', array($options), true, $module);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
@ -2096,7 +2096,6 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
|
||||
//<![CDATA[
|
||||
|
||||
var skipClientValidation = false;
|
||||
var containsErrors = false;
|
||||
|
||||
function qf_errorHandler(element, _qfMsg) {
|
||||
div = element.parentNode;
|
||||
@ -2205,7 +2204,6 @@ function validate_' . $this->_formName . '(frm) {
|
||||
var frm = document.getElementById(\''. $this->_attributes['id'] .'\')
|
||||
var first_focus = false;
|
||||
' . $validateJS . ';
|
||||
containsErrors = !ret;
|
||||
return ret;
|
||||
}
|
||||
//]]>
|
||||
|
Loading…
x
Reference in New Issue
Block a user