提交 8f8ffe76 编写于 作者: M mindless

[FIXED HUDSON-6025] simplify form.onsubmit handling with combobox.

1) in onblur handler, simply restore old form.onsubmit rather than adding
   another wrapper to call the old handler (which can result in a deep call
   stack if several comboboxes are used prior to form submission).
2) in onsubmit handler when focused, only call the original onsubmit when
   the dropdown is not showing (ie don't call it when we intercept the submit
   to just select an item from the list and return false)
I didn't figure out exactly why, but the current code could result in the
original form.onsubmit handler not being called on form submission when
multiple comboboxes are used.  This simplification seems to resolve the issue.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@29149 71c3de6d-444a-0410-be80-ed276b4c234a
上级 8016aae4
......@@ -114,17 +114,15 @@ function ComboBox(idOrField, callback, config) {
this.field.form.oldonsubmit = this.field.form.onsubmit;
this.field.onfocus = function() {
this.form.onsubmit = function() {
if (self.isDropdownShowing) return false;
if (this.oldonsubmit) this.oldonsubmit();
return ! self.isDropdownShowing;
return true;
};
}
this.field.onblur = function() {
var cb = this.comboBox;
this.hideTimeout = setTimeout(function() { cb.hideDropdown(); }, 100);
this.form.onsubmit = function() {
if (this.oldonsubmit) this.oldonsubmit();
return true;
};
this.form.onsubmit = this.form.oldonsubmit;
}
// privileged methods
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册