You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eirik Kj�lsrud <wa...@frisurf.no> on 2003/06/18 12:40:26 UTC

Struts validator, validating dates with pattern.

Hi.

I'm using Struts 1.1 RC1 and wants to validate a date in an input field as
required and date. The part in validation.xml describing the validation is :

<field property="orderstart" depends="required,date">
    <arg0 key="gameparamForm.orderstart.displayname"/>
    <var>
        <var-name>datePattern</var-name>
        <val-value>dd.MM.yyyy</val-value>
    </var>
 </field>

The required field triggers, but regardless of value in the date field, the
date validation does not trigger an error message. In the application
resources file, the errors.date field is populated.

Any help is greatly appreciated !

Best Regards
Eirik Kj�lsrud, Norway




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


Re: Struts validator, validating dates with pattern.

Posted by Eirik Kjølsrud <wa...@frisurf.no>.
Hi Nagendra, and thanks for your suggestion !

That "kinda" worked... 
Using <var>
                 <var-name>datePatternStrict</var-name>
                <var-value>dd.MM.yyyy</var-value>
          </var>

resulted in the datefield being correctly validated to the dd.MM.yyyy format, but I would also like it to allow both these formats of date : 
08.11.1976 and 8.11.1976. I believe that the use of datePatternStrict force the use of leading zeros ?

How come when I use only datePattern instead of datePatternStrict, nothing is validated ?

Best Regards
Eirik Kjølsrud

      -------------- original message -------------
      > hi,
      >  use this syntax
      >            <var>
      >              <var-name>datePatternStrict</var-name>
      >              <var-value>dd/MM/yyyy</var-value>
      >          </var>

     

Re: Struts validator, validating dates with pattern.

Posted by Nagendra Kumar O V S <na...@ikigo.com>.
hi,
 use this syntax
            <var>
              <var-name>datePatternStrict</var-name>
              <var-value>dd/MM/yyyy</var-value>
          </var>

-nagi

-------Original Message-------

From: Struts Users Mailing List
Date: Wednesday, June 18, 2003 04:13:45 PM
To: struts-user@jakarta.apache.org
Subject: Struts validator, validating dates with pattern.

Hi.

I'm using Struts 1.1 RC1 and wants to validate a date in an input field as
required and date. The part in validation.xml describing the validation is :

<field property="orderstart" depends="required,date">
<arg0 key="gameparamForm.orderstart.displayname"/>
<var>
<var-name>datePattern</var-name>
<val-value>dd.MM.yyyy</val-value>
</var>
</field>

The required field triggers, but regardless of value in the date field, the
date validation does not trigger an error message. In the application
resources file, the errors.date field is populated.

Any help is greatly appreciated !

Best Regards
Eirik Kjølsrud, Norway




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


.