[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: html:file usage
That kind of behaviour is not what anyone would want, but I believe it is standard behaviour. The
only way to get a value pre-populated in it is to do this:
1. Create a hidden field.
2. Write some JavaScript that copies the value from the file field to the hidden field just
before the form is submitted. This needs to be executed in the onclick event handler for your
submit button or graphic, not from inside form_onsubmit. This is because, IIRC, the form_onsubmit
event is not fired if the form is submitted programmatically (i.e. with script that calls
frm.submit()).
3. When the form is kicked back to the user, place the filename in the hidden field and write
more JavaScript that runs in the body_onload event and copies the value back from the hidden field
to the file field.
Ed
--- Poorav Chaudhari <pooravc@yahoo.com> wrote:
> I am building an application using tomcat and struts framework.
>
> I am facing a strange problem in implementing html:file tag. under normal
> circumstances i am able to upload the file without any problems. now suppose i
> have a form of few other fields like text, checkbox, etc., and including the
> file field. If someone enters an invalid field. i do a server side validation
> and take the user back to the form page so that they can re-enter the invalid
> field. the rest of the field stay populated as expected but the file field
> becomes empty. which is not the behaviour i want. The file field should remain
> populated with the file i selected in my file open dialog box. is this a normal
> behaviour with html:file or am i missing something. My html file tag looks as
> follows.
> <html:file property="resumeFile" name="resourceForm"/>
>
>
> =====
> Poorav Chaudhari
=====
Come with me to Orlando in April for the 2nd Annual
Informational Meeting for The Christian Film Festival.
http://www.christianfilmfestival.org/orlando_volunteerschedule.php
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com