Tanks Gary, excellent explanation.

I don't know if it is solved in the last version ... anyhow, in the shale-framework-1.0.3-snapshot there is a problem with the commons-validator-1.1.4 library. The shale CommonsValidator class try to invoke the ValidatorResources constructor with a String[] type that don't exists (line 507). I changed to an old commons-validator library and works fine.

Thanks.

----- Original Message ----- From: "Gary VanMatre" <[EMAIL PROTECTED]>
To: <[email protected]>; "Daniel del Río" <[EMAIL PROTECTED]>
Sent: Monday, August 21, 2006 5:43 AM
Subject: Re: Adding commonsValidator to a clay component


>From: Daniel del Río <[EMAIL PROTECTED]>

Hello,
Someone knows if it is possible to add a commonsValidation component in a clay
component?

<component jsfid="mycomponent" extends="inputText">
       <element id="validator" renderId="1" jsfid="s:commonsValidator">
           <attributes>
               <set name="type" value="required"/>
               <set name="client" value="true"/>
           </attributes>
       </element>
   </component>


You will need to register a validator using the "validator" node.

<component jsfid="mycomponent" extends="inputText">
       <validator jsfid="s:commonsValidator">
           <attributes>
               <set name="type" value="required"/>
               <set name="client" value="true"/>
           </attributes>
       </validator>
</component>

If you want to use multiple commonsValidators on a single component, you
will need to use different jsfid's. The jsfid is the "key" for the Set of validators.


Consider:

<component jsfid="mycomponent" extends="inputText">
       <validator jsfid="s:commonsValidatorRequired">
           <attributes>
               <set name="type" value="required"/>
               <set name="client" value="true"/>
           </attributes>
       </validator>
       <validator jsfid="s:commonsValidatorEmail">
           <attributes>
               <set name="type" value="email"/>
               <set name="client" value="true"/>
           </attributes>
       </validator>

</component>

There are default alias validators defined. I just realized that these don't implicitly define the types so you will have to provide the "type".

s:commonsValidatorRequired, s:commonsValidatorMaxlength, s:commonsValidatorMinlength, s:commonsValidatorMask, s:commonsValidatorByte, s:commonsValidatorShort, s:commonsValidatorInteger, s:commonsValidatorLong, s:commonsValidatorFloat, s:commonsValidatorDouble, s:commonsValidatorDate, s:commonsValidatorIntRange, s:commonsValidatorFloatRange, s:commonsValidatorDoubleRange, s:commonsValidatorCreditCard, s:commonsValidatorEmail, s:commonsValidatorUrl

Thanks in advance.
drh.


Gary


Reply via email to