struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Riyaz Mansoor <rman...@gmail.com>
Subject Re: Validator inheritance
Date Fri, 20 May 2005 16:08:43 GMT

i asked this same question and the answer i got here is:

this was added to Validator but not public release has been made after this.

u can download a source distro of validator and compile and use it.

 > <form name="myExtForm1" extends="myForm1">

the above should work as is - i am using it :)

riyaz


Yaroslav Novytskyy wrote:
> Hi!
> 
> Does anyone know about the way to "inherit" (1) and "reuse" (2) 
> validations for multiple forms in validation.xml
> Explanation:
> 1.
> I have a number of myForms: myForm1, myForm2, and so on they are of 
> class MyForm (so they all have same fields) and I want them to validate 
> the same.
> e.g.
> <form name="myForm1, myForm2">
>     <field
>         property="elementIndex"
>         depends="integer">
>         <arg0 key="Element index" resource="false"/>
>     </field>
> </form>
> 
> 2.
> When I inherit MyExtForm from MyForm adding some fields and make 
> form-beans myExtForms: myExtForm1, myExtForm2, and so on and would like 
> them to "inherit" validation definitions from MyForm.
> 
> <form name="myExtForm1" extends="myForm1">
>     //!!!validation for elementIndex field
>     //already inherited!!!
>     <field
>        property="subElementIndex"
>        depends="required">
>        <arg0 key="Sub element index" resource="false"/>
>     </field>
> </form>
> 
> Yaroslav Novytskyy
> P.S.
> this would "compress" size of the validator.xml file
> (in my case 10-20 times!)
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message