struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Friedman" <hum...@ix.netcom.com>
Subject RE: FormFile not re-populated
Date Tue, 02 Dec 2003 00:40:01 GMT
Since you mentioned FormFiles and failed validations, I'd like to share
something:  It's a pain that you lose the uploaded file if the form
validation fails.  I decided to make my validation screen do a special
message to please upload the files again because form Validation failed IF
any files were uploaded.  My problem was: how do you detect if files were
uploaded?  I chose to examine my ActionForm's FormFile fields and count the
total bytes.  IF it's zero, nothing was uploaded so I won't show the
reminder to re-attach the files.

Does anyone have a better method for dealing with losing files on Validation
failure?

Thanks for any constructive feedback,
David

-----Original Message-----
From: James Mitchell [mailto:jmitchell@apache.org]
Sent: Monday, December 01, 2003 1:30 PM
To: Struts Users Mailing List
Subject: Re: FormFile not re-populated


On Mon, 1 Dec 2003, Sharmila Pandith wrote:

> Hi,
>
> I am using FormFile and after it is validated it must be displayed on the
> next JSP. However, the field is blank. When I look at the source in IE6, I
> see the file name without the directory. But even that is not displayed.
>
> Any thoughts?


Yes, basically, you cannot expect to pre-fill an input field of type
"file" (html file upload box with browse button).  It is not supported in
all browsers and those that do, prompt the user to so they can cancel the
field value or the form all-together.

You would be better off doing something like this:
1. Show page (with file upload button), and ask the user if they want
   to upload additional files (radio button or something)
2. If yes, then after that page is processed, show it again, only this
   time with file listed off to the side (similar to how a summary view
   of a shopping cart might do)
3. If no, then move along with your wizard.

Does that help?



>
> S P
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>

--
James Mitchell
Software Developer / Struts Evangelist
http://www.struts-atlanta.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message