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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
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: 15376
    
    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://aspose.com/file-tools
 
subject: reset the value of the file input path