PDA

View Full Version : UpdateManager.formUpdate bug when setting reset to true ?



arnaud
7 Feb 2007, 7:52 AM
When using the formUpdate method of the updateManager I noticed the form was not reset properly.

After some hunting around I found that the method does not work (at least with FF 2).

The call is such


response.argument.form.reset();

An execption is thrown on that since
response.argument.form is a string of the element'd id and thus the call fails.

Using


document.forms[response.argument.form].reset();

yields better results.

It seems weird though so I would welcome any info on this.

aconran
7 Feb 2007, 8:11 AM
Arnaud -

I had noticed this same bug a few weeks ago when completing a little app with the formUpdate method. When passing true to the optional form reset bool it doesn't seem to work. I didn't have time to dig into the problem but what I did was just listen to the 'update' event and reset the form that way.

myUpdateMgr.on('update', this.resetForm.createDelegate(this));

Hopefully this will be fixed in the upcoming release or someone else can let us know what we're doing wrong

Aaron

Animal
7 Feb 2007, 9:01 AM
Good catch.

It's setting up the argument wrong.



formUpdate : function(form, url, reset, callback){
if(this.beforeUpdate.fireDirect(this.el, form, url) !== false){
this.showLoading();
formEl = YAHOO.util.Dom.get(form);
if(typeof url == 'function'){
url = url();
}
if(typeof params == 'function'){
params = params();
}
url = url || formEl.action;
var callback = {
success: this.successDelegate,
failure: this.failureDelegate,
timeout: (this.timeout*1000),
argument: {'url': url, 'form': form, 'callback': callback, 'reset': reset} // <-- should be formEl.
};
var isUpload = false;
var enctype = formEl.getAttribute('enctype');
if(enctype && enctype.toLowerCase() == 'multipart/form-data'){
isUpload = true;
}
YAHOO.util.Connect.setForm(form, isUpload, this.sslBlankUrl);
this.transaction = YAHOO.util.Connect.asyncRequest('POST', url, callback);
}
},

jack.slocum
8 Feb 2007, 1:01 AM
Thanks guys. I've changed it to point to formEl.

krycek
29 Jun 2007, 5:07 AM
i think this bug is back (1.1beta1 and 1.1beta2)... a little different

please take a look at: http://extjs.com/forum/showthread.php?t=8413