Type conversion errors are put into a Map on the ActionContext. I forget
the exact name, but it's probably conversionErrors or something like
that... It's a Map of fieldName -> original value. You could edit your
templates to always load this if the field is in the Map, rather than
displaying back an empty field. 

> -----Original Message-----
> From: Francisco Hernandez [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, February 10, 2004 3:39 PM
> To: [EMAIL PROTECTED]
> Subject: [OS-webwork] displaying invalid data entered for non 
> String values
> 
> 
> not too sure how to handle this cleanly but I want have a textfield 
> where with a property of java.util.Date so users can input a 
> date like 
> 03/17/1980
> and that works fine, but if they enter 03/1x7/1980 it should present 
> them an error message but also redisplay 03/1x7/1980 in the 
> textfield so 
> they
> can just remove the x and happily proceed, but since theDate 
> is null its 
> not redisplaying the previously entered values
> 
> if my jsp im using:
> <ww:textfield label="'Enter Date'" name="'theDate'" value="theDate" />
> 
> and to validate:
>  public void validate() {
>         if (theDate == null) {
>             addFieldError("theDate", "Please input correct Date! you 
> entered: " +
>                     
> ((String[])ActionContext.getContext().getParameters().get("the
> Date"))[0]);
>         }
>     }
> 
> I could add another property like theDateString and do some 
> more logic 
> in validate() but that smells bad.. anyone have any ideas?
> 
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration 
> See the breadth of Eclipse activity. February 3-5 in Anaheim, 
> CA. http://www.eclipsecon.org/osdn 
> _______________________________________________
> Opensymphony-webwork mailing list 
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to