You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by co...@jakarta.apache.org on 2004/05/20 21:53:47 UTC

[Jakarta Commons Wiki] New: ValidatorDatesFormatting

   Date: 2004-05-20T12:53:47
   Editor: RobertBurrellDonkin <rd...@apache.org>
   Wiki: Jakarta Commons Wiki
   Page: ValidatorDatesFormatting
   URL: http://wiki.apache.org/jakarta-commons/ValidatorDatesFormatting

   Movced from original wiki

New Page:

Up to ValidatorFaq
----

Do most people allow users to type in a complete free-form text date?  Or do
you give them three boxes where they must put in month day and year
separately?

I'm trying to come to terms with validation.  I can't turn on the automatic
validation <action validate="true" ... > because the users are allowed to
leave the form before it's complete and come back to it.  Will I still be
able to use the plug-in Validator?  (All the actions in the struts-validator
example have 'validate' this turned on. 

But here's where I get lost.  In order to copy the properties back and forth
from Value Object to ActionForm, the types have to match.  (Don't they?) But
if I put a java.sql.Date into my ActionForm, then it will blow up when the
user types 7/13/1985 rather than 1985-07-13 and submits the form.

So, I need a String property in the ActionForm, and ... some special
something that turns it into a java.sql.Date but will not blow up if the
input is wrong?

== Answer(s) ==

we use this
http://developer.iplanet.com/viewsource/husted_calendar/husted_calendar.html

-Tim Cronin

Also Commons BeanUtils provides a number of automatic conversions, so this
might be performed already.

Rob Leland
----
Up to ValidatorFaq


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