Skip to content

Commit

Permalink
[FIXED JENKINS-21613] combobox now recovers form.onsubmit to the one …
Browse files Browse the repository at this point in the history
…just before override.
  • Loading branch information
ikedam committed Mar 25, 2018
1 parent a30ada7 commit d0ff413
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions war/src/main/webapp/scripts/combobox.js
Expand Up @@ -88,6 +88,7 @@ function ComboBox(idOrField, callback, config) {
alert("You have specified an invalid id for the field you want to turn into a combo box");
this.dropdown = document.createElement("div");
this.isDropdownShowing = false;
this.oldonsubmit = null;

// configure the dropdown div
this.dropdown.className = "comboBoxList";
Expand All @@ -111,11 +112,11 @@ function ComboBox(idOrField, callback, config) {
this.setSelectionRange(length, length);
}
}
this.field.form.oldonsubmit = this.field.form.onsubmit;
this.field.onfocus = function() {
this.comboBox.oldonsubmit = this.form.onsubmit;
this.form.onsubmit = function() {
if (self.isDropdownShowing) return false;
if (this.oldonsubmit) this.oldonsubmit();
if (self.oldonsubmit) self.oldonsubmit.call(this);
return true;
};
// repopulate and display the dropdown
Expand All @@ -124,7 +125,7 @@ function ComboBox(idOrField, callback, config) {
this.field.onblur = function() {
var cb = this.comboBox;
this.hideTimeout = setTimeout(function() { cb.hideDropdown(); }, 100);
this.form.onsubmit = this.form.oldonsubmit;
this.form.onsubmit = cb.oldonsubmit;
}

// privileged methods
Expand Down

0 comments on commit d0ff413

Please sign in to comment.