struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Schmidgall" <aschmidg...@sedonaesolutions.com>
Subject Validator datePattern difficulties
Date Mon, 01 Dec 2003 17:15:39 GMT
Hello,

For my webapp I need to make sure a date is in the form 'mm/dd/yy', but
I haven't been able to achieve this with the struts validator (I only
need the javascript to work for now). All the examples I can find use
'MM/dd/yyyy' or 'MM-dd-yyyy'. If I switch to one of these and put in a 4
char date, then it validates ok, but I need to validate on the 2 char
date, not 4. Is this doable with the struts validator?

This is my validation definition:

            <field property="transactionDateString"
depends="required,date">
                <arg0
key="TruckMovementForm.transactionDateString.displayname"/>
                <arg1 key="${var:datePatternStrict}" resource="false"/>
                <var>
                    <var-name>datePatternStrict</var-name>
                    <var-value>MM/dd/yy</var-value>
                </var>
            </field>

If I switch to datePattern (rather than datePatternStrict) it lets
anything at all through! That's definitely not what I want either.

Thanks,
Andy

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


Mime
View raw message