[FIXED combobox now recovers form.onsubmit to the one just before override.
@@ -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";
@@ -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
@@ -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
