You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Shoukat, Faisal" <fa...@northgate-is.com> on 2006/06/09 17:25:45 UTC

check invalid date with validator framework

Hi

Is there a way to check if the date is a valid date in the validator
framework.  If I enter a invalid date such as 67/06/2006 it returns me the
error message Created Date is not a valid date format (dd/mm/yyyy).

Which is the error.date in my message resources.  However I want to not
check the format in this case but want it to check that the 67 is invalid?

Thanks

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


Re: check invalid date with validator framework

Posted by The Jasper <th...@gmail.com>.
On 6/9/06, Shoukat, Faisal <fa...@northgate-is.com> wrote:
> Is there a way to check if the date is a valid date in the validator
> framework.  If I enter a invalid date such as 67/06/2006 it returns me the
> error message Created Date is not a valid date format (dd/mm/yyyy).
>
> Which is the error.date in my message resources.  However I want to not
> check the format in this case but want it to check that the 67 is invalid?


Hi,

The date validator doesn't really make a difference between an invalid
date and an invalid format. It's the same. You can specify whether you
want a strict date format or not. Strict means it will only accept
dates as dd/mm/yyyy so it wont accept 5/5/2006 but only 05/05/2006.
For the rest it pretty much uses java.util.Date to do the validation.

if the error message bothers you, write a new one. You can use the msg
property or just the errors.date for that.


mvg,
Jasper

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