aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes reset the value of the file input path Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "reset the value of the file input path" Watch "reset the value of the file input path" New topic
Author

reset the value of the file input path

Calvin Kong
Ranch Hand

Joined: Jul 02, 2003
Posts: 37
Hi, I have a question about setting the value (to empty string, or anything) of the file input path. I was thinking it worked as the same way as a text field, but it's not. The value is not changed. So is there any trick to do that with the <input type="file" >?

Thanks a lot!

Calvin


Cal<br />SCJP,SCWCD,SCBCD
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15357
    
    6
This might do it....

document.formName.elementName.reset();
Calvin Kong
Ranch Hand

Joined: Jul 02, 2003
Posts: 37
This works, but is there any way other than that? Since reset() will clear everything in the form. Is there any way that I can reset only the file upload field?

Thanks a lot.

Calvin
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
Create your own function that will go through the code, remember what was selected in each element, than do "reset" on form, and restore values.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: reset the value of the file input path
 
Similar Threads
The input attribute of the action tag not working
How to retain a selected file path in a input type="file" in html
jsp doubt
Issue w/ accesing file from a Servlet
Button?