You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ivan <iv...@interd4u.com> on 2004/05/17 09:45:10 UTC

Date Time field validation

Hi, 

I have a form field representing a date in the format dd/MM/yyyy HH:mm (14/05/2004 13:03)
My problem is that validator cannot handle time in its date validations rutines.

Neither using mask validation with the regular expression ^\d{2}/\d{2}/\d{4} \d{2}:\d{2}$ works, because it throw a javascript error (!)

date doens t work
mask doesn t work

any viable solution?


regards,
ivan

Re: Date Time field validation

Posted by Ivan <iv...@interd4u.com>.
Ok thanks, we can see there is a problem with date and mask validation
-There is no date(time) validators
-Java regular expressions are not escaped for javascript logic.



----- Original Message ----- 
From: "Dean A. Hoover" <dh...@rochester.rr.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Monday, May 17, 2004 2:52 PM
Subject: Re: Date Time field validation


> I'm not sure if this will help but how about escaping the forward
> slashes;
>
> ^\d{2}\/\d{2}\/\d{4} \d{2}:\d{2}$
>
> you may have to escape the backslashes as well (you have to
> do this when constructing a RE in C:
>
> ^\\d{2}\\/\\d{2}\\/\\d{4} \\d{2}:\\d{2}$
>
> don't know about javascript... just a thought.
>
> Dean Hoover
>
>
> Ivan wrote:
>
> >Hi,
> >
> >I have a form field representing a date in the format dd/MM/yyyy HH:mm
(14/05/2004 13:03)
> >My problem is that validator cannot handle time in its date validations
rutines.
> >
> >Neither using mask validation with the regular expression
^\d{2}/\d{2}/\d{4} \d{2}:\d{2}$ works, because it throw a javascript error
(!)
> >
> >date doens t work
> >mask doesn t work
> >
> >any viable solution?
> >
> >
> >regards,
> >ivan
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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


Re: Date Time field validation

Posted by "Dean A. Hoover" <dh...@rochester.rr.com>.
I'm not sure if this will help but how about escaping the forward
slashes;

^\d{2}\/\d{2}\/\d{4} \d{2}:\d{2}$

you may have to escape the backslashes as well (you have to
do this when constructing a RE in C:

^\\d{2}\\/\\d{2}\\/\\d{4} \\d{2}:\\d{2}$

don't know about javascript... just a thought.

Dean Hoover


Ivan wrote:

>Hi, 
>
>I have a form field representing a date in the format dd/MM/yyyy HH:mm (14/05/2004 13:03)
>My problem is that validator cannot handle time in its date validations rutines.
>
>Neither using mask validation with the regular expression ^\d{2}/\d{2}/\d{4} \d{2}:\d{2}$ works, because it throw a javascript error (!)
>
>date doens t work
>mask doesn t work
>
>any viable solution?
>
>
>regards,
>ivan
>  
>



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