struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sivaswamynatha K" <k.sivaswamyna...@Kavniya.com>
Subject acessing form values in validation.xml
Date Wed, 09 Jan 2008 10:14:14 GMT
Hi,

 

Is it possible to access the form variables in the validation.xml file.
I am using Struts 1.2.9

Ie. I have a requirement to enter the year field between 1800 to current
year + years.

 

In validation.xml

<field property="builtYear" depends="mask,validwhen">

<msg resource="true" key="errors.builtYear" name="validwhen" />

      <msg resource="true" key="errors.mask" name="mask" />

      <arg position="0" key="label.mortgageinfo.builtyear" />

????<arg position="1" ?/>                       

                        

      <var>

            <var-name>mask</var-name>

            <var-value>${year}</var-value>

      </var>

      <var>

            <var-name>test</var-name>

            <var-value>((builtYear == null) or ((builtYear >1800) and
(builtYear &lt; futureYear)))</var-value>

      </var>                        

</field>

 

I set the value of futureYear is action and it changes according to the
current year. The validation is fine. Now I want to show the error
message when the validation fails.

The error is just like 

'The built year ranges between 1800 and <customizedvalue>'

 

In message resources 

errors.builtYear= The {0}  ranges between 1800 and {1}

 

 

Regards,

K. Siva.

 

If you win you need not explain ... But if you lose you should not be
there to explain -- Adolf Hitler

 

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message