diff -u b/core/misc/ajax.js b/core/misc/ajax.js
--- b/core/misc/ajax.js
+++ b/core/misc/ajax.js
@@ -648,7 +648,6 @@
// There is no simple way to know which submission mechanism will be used,
// so we add to extraData regardless, and allow it to be ignored in the
// former case.
- this.hiddenCopy = null;
if (this.$form) {
options.extraData = options.extraData || {};
@@ -659,18 +658,12 @@
// The triggering element is about to be disabled (see below), but if it
// contains a value (e.g., a checkbox, textfield, select, etc.), ensure
- // value is included in all submissions. As per above, submissions that use
- // $.ajax() are already serialized prior to the element being disabled.
- // However, that does not handle IFRAME submissions, nor does it handle any
- // subsequent submissions that may happen before this ajax request is
- // complete. To cover these cases, create a hidden version of the input
- // field, that is deleted when the request is complete.
+ // that value is included in the submission. As per above, submissions
+ // that use $.ajax() are already serialized prior to the element being
+ // disabled, so this is only needed for IFRAME submissions.
var v = $.fieldValue(this.element);
if (v !== null) {
- this.hiddenCopy = $('')
- .attr('name', this.element.name)
- .val(Drupal.checkPlain(v));
- $(this.element).after(this.hiddenCopy);
+ options.extraData[this.element.name] = v;
}
}
@@ -740,10 +733,6 @@
if (this.progress.object) {
this.progress.object.stopMonitoring();
}
- // Remove the hidden version of the input element.
- if (this.hiddenCopy) {
- $(this.hiddenCopy).remove();
- }
$(this.element).prop('disabled', false);
// Save element's ancestors tree so if the element is removed from the dom
@@ -772,6 +761,7 @@
// There is no simple way to know which submission mechanism will be used,
// so we add to extraData regardless, and allow it to be ignored in the
// former case.
+ this.hiddenCopy = null;
if (this.$form) {
options.extraData = options.extraData || {};
@@ -782,12 +772,18 @@
// The triggering element is about to be disabled (see below), but if it
// contains a value (e.g., a checkbox, textfield, select, etc.), ensure
- // that value is included in the submission. As per above, submissions
- // that use $.ajax() are already serialized prior to the element being
- // disabled, so this is only needed for IFRAME submissions.
+ // value is included in all submissions. As per above, submissions that
+ // use $.ajax() are already serialized prior to the element being
+ // disabled. However, that does not handle IFRAME submissions, nor does
+ // it handle any subsequent submissions that may happen before this ajax
+ // request is complete. To cover these cases, create a hidden version of
+ // the input field, that is deleted when the request is complete.
var v = $.fieldValue(this.element);
if (v !== null) {
- options.extraData[this.element.name] = v;
+ this.hiddenCopy = $('')
+ .attr('name', this.element.name)
+ .val(Drupal.checkPlain(v));
+ $(this.element).after(this.hiddenCopy);
}
}
@@ -841,10 +837,6 @@
if (this.progress.object) {
this.progress.object.stopMonitoring();
}
- // Remove the hidden version of the input element.
- if (this.hiddenCopy) {
- $(this.hiddenCopy).remove();
- }
// Undo hide.
$(this.wrapper).show();
// Re-enable the element.
@@ -863,6 +855,10 @@
if (this.progress.object) {
this.progress.object.stopMonitoring();
}
+ // Remove the hidden version of the input element.
+ if (this.hiddenCopy) {
+ $(this.hiddenCopy).remove();
+ }
$(this.element).prop('disabled', false);
// Save element's ancestors tree so if the element is removed from the dom
@@ -968,6 +964,10 @@
if (this.progress.object) {
this.progress.object.stopMonitoring();
}
+ // Remove the hidden version of the input element.
+ if (this.hiddenCopy) {
+ $(this.hiddenCopy).remove();
+ }
// Undo hide.
$(this.wrapper).show();
// Re-enable the element.