PDA

View Full Version : [1.1RC1] [Updated] form.reset() ! working for IE6 file inputs, works fine for FireFox



jay@moduscreate.com
13 Jul 2007, 8:42 AM
In IE6 the Ext.form.Form.reset function fails to reset the item.
Open the following URL in IE6 and FF
http://tdg-i.com/extjs/examples/formResetBug/

jay@moduscreate.com
13 Jul 2007, 12:13 PM
I don't think this is an EXTJS bug but rather an IE6 bug. I need to fire up my vista VM and see if it is an issue in IE7 as well.

Turns out that IE6 for some reason doesn't have a reset() function attached to the input object type of file. Likewise, I can't do a myInputObj.value = 'my value'. If i try a .setRawValue() or .setValue() on the element directly i still get nothing changed. The only thing i can do to clear that entry take a snapshot of the form's data, is do a blanket form.reset() then repopulate everything that is not a file. :-\


The code below is responsible for doing a .reset() on each item in the form list.


## BasicForm.js
352 /**
353 * Resets this form.
354 * @return {BasicForm} this
355 */
356 reset : function(){
357 this.items.each(function(f){
358 f.reset();
359 });
360 return this;
361 },
362


hope i didn't miss anything.

indulgence
14 Jul 2007, 8:19 PM
I don't think this is an EXTJS bug but rather an IE6 bug. I need to fire up my vista VM and see if it is an issue in IE7 as well.

Turns out that IE6 for some reason doesn't have a reset() function attached to the input object type of file. Likewise, I can't do a myInputObj.value = 'my value'. If i try a .setRawValue() or .setValue() on the element directly i still get nothing changed. The only thing i can do to clear that entry take a snapshot of the form's data, is do a blanket form.reset() then repopulate everything that is not a file. :-\


The code below is responsible for doing a .reset() on each item in the form list.


## BasicForm.js
352 /**
353 * Resets this form.
354 * @return {BasicForm} this
355 */
356 reset : function(){
357 this.items.each(function(f){
358 f.reset();
359 });
360 return this;
361 },
362


hope i didn't miss anything.

This is a security feature. You shouldn't be able to set/modify on input type=file in firefox either... and has been around forever. Otherwise - a malevolent js programmer could add arbitrary files and upload them w/o user interaction. Firefox might expose a clear function... but you won't be able to directly set a value.

So its going to be a no-go for setting/modifying any file inputs. Hope that clarifies that.