-
10 Oct 2007 4:24 AM #1
Reset the input type file field to blank
Reset the input type file field to blank
Hi,
I am trying to submit a file (browse button), after which the field should be blank.As i have many other fields in the form I can't do reset:true.I just require the following field to be blank after form submit. Thanks in advance.
The file field:
uploadForm.add(hedit_objFile =new Ext.form.TextField({
allowBlank: true,
id: 'file_path',
inputType: 'file',
name: 'upload_file',
fieldLabel: 'File',
width:243,
height:22,
blankText: 'Please choose a file'
})
);
-
10 Oct 2007 5:58 AM #2
-
10 Oct 2007 8:42 PM #3
Thanks for your reply.
Sorry I forgot to mention that I am trying to set the value using
hedit_objFile.setValue('');
but it seems that it is not being compiled at all as the value is not being resetted.
-
10 Oct 2007 9:06 PM #4
And one more thing is that this code works perfectly in mozilla but in IE it not resetting the file's value in the form.
-
2 May 2009 8:46 PM #5
-
18 Jun 2009 3:36 AM #6
Hi,
I get the same problem, so do any body found a solution for this ????
-
18 Jun 2009 5:15 AM #7
Hi all, I see that this problem is for a long time, but today I get the same, than I found this thread (I don't know if the person found or solution or not, now I created a function to deal with this problem and I want to put it here if some one get this problem again
the function is commented :
all what you have to make is calling this function with your element id (I tested well and it work 100% on FF and IE)Code:function clearFileUpload(id){ // get the file upload element fileField = document.getElementById(id); // get the file upload parent element parentNod = fileField.parentNode; // create new element tmpForm = document.createElement("form"); parentNod.replaceChild(tmpForm,fileField); tmpForm.appendChild(fileField); tmpForm.reset(); parentNod.replaceChild(fileField,tmpForm); }
-
6 Jan 2011 9:55 AM #8
-
6 Nov 2011 9:40 AM #9
-
10 Jan 2012 11:08 PM #10
Many thanks. I've tried other suggestions, but none of them don't work for me.


Reply With Quote