I think there is a trick you can perform with regard to this:

>  2) Or is it possible in action read the value of the var named 
>      datePattern in validation for particular form??

You can call your validate method in your Form.validate() initial when you populate 
the form.  If the date format is not the one you wanted, you use a decorator to format 
it, but don't add the error to the errors collection(since this is just displaying the 
form).  On the client side, you can call validateWhen(myForm) in onLoad(), etc.

Do I understand what you wanted to do correctly:). 


-----Original Message-----
From: Jiøí Mareš [mailto:[EMAIL PROTECTED] 
Sent: August 5, 2003 1:42 AM
To: Struts Users Mailing List
Subject: Date validation and format


Hi all,

I have question to date validation. In validation.xml I specified the 
field folowing way:

<field property="when" depends="required,date">
        <arg0 key="demand.when" resource="true" name="required"/>
        <arg0 key="demand.when" resource="true" name="date"/>
        <arg1 key="${var:datePattern}" resource="false" name="date"/>
        <var>
                <var-name>datePattern</var-name>
                <var-value>yyyy.MM.dd</var-value>
        </var>
</field>

and everything is working, but, when I edit the field I would like to 
load the date frm DB and format the date the same pattern as is 
specified in the validation.xml.

And here is my question.

1) Is it possible to specifi the var-value as the key in 
applicationResources to be able from application load the same value of 
the key.

2) Or is it possible in action read the value of the var named 
datePattern in validation for particular form??

Thanks a lot.

-- 
Jiří Mareš (mailto:[EMAIL PROTECTED])
ČSAD SVT Praha, s.r.o. (http://www.svt.cz)
Czech Republic


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to