[Jifty-commit] r1513 - in jifty/trunk: share/web/static/js
share/web/static/js/scriptaculous
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Jul 7 22:09:26 EDT 2006
Author: trs
Date: Fri Jul 7 22:09:26 2006
New Revision: 1513
Modified:
jifty/trunk/ (props changed)
jifty/trunk/share/web/static/js/jifty.js
jifty/trunk/share/web/static/js/scriptaculous/controls.js
Log:
r14121 at zot: tom | 2006-07-07 22:08:57 -0400
Fix the validation and autocomplete race condition
Modified: jifty/trunk/share/web/static/js/jifty.js
==============================================================================
--- jifty/trunk/share/web/static/js/jifty.js (original)
+++ jifty/trunk/share/web/static/js/jifty.js Fri Jul 7 22:09:26 2006
@@ -805,7 +805,28 @@
this.url = '/__jifty/autocomplete.xml';
Event.observe(this.field, "focus", this.onFocus.bindAsEventListener(this));
- this.baseInitialize(this.field, $(div), { minChars: "0" });
+ this.baseInitialize(this.field, $(div), {
+ minChars: "0",
+ beforeShow: this.beforeShow,
+ beforeHide: this.beforeHide
+ });
+ },
+
+ beforeShow: function(obj) {
+ /* Prevents the race for canonicalization and updating
+ via autocomplete */
+ if ( obj.element.onblur ) {
+ obj.element._onblur = obj.element.onblur;
+ obj.element.onblur = null;
+ }
+ },
+
+ beforeHide: function(obj) {
+ /* Restore onblur and config option */
+ if ( obj.element._onblur ) {
+ obj.element.onblur = obj.element._onblur;
+ obj.element._onblur = null;
+ }
},
onFocus: function(event) {
Modified: jifty/trunk/share/web/static/js/scriptaculous/controls.js
==============================================================================
--- jifty/trunk/share/web/static/js/scriptaculous/controls.js (original)
+++ jifty/trunk/share/web/static/js/scriptaculous/controls.js Fri Jul 7 22:09:26 2006
@@ -79,6 +79,9 @@
},
show: function() {
+ /* Next line added by TRS, 07 July 2006 */
+ if ( this.options.beforeShow ) this.options.beforeShow(this);
+
if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
if(!this.iefix &&
(navigator.appVersion.indexOf('MSIE')>0) &&
@@ -101,6 +104,9 @@
},
hide: function() {
+ /* Next line added by TRS, 07 July 2006 */
+ if ( this.options.beforeHide ) this.options.beforeHide(this);
+
this.stopIndicator();
if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
if(this.iefix) Element.hide(this.iefix);
More information about the Jifty-commit
mailing list