Did you register the validator in the faces-xml file? 

-----Original Message-----
From: Ali Abdel-Aziz Ali [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 26, 2006 6:52 AM
To: MyFaces Discussion
Subject: Custom Validation Problem

Hi All,
I have problem in building Custom Validation.
I want build custom validator that accept name property for the other
component that it will make the validation with it.
I need to build validator similar to the t:validateEqual 

here are what I did:-
copy and past the EqualValidator, and EqualValidatorTag and make code
changes to do what I want
  changed the VALIDATOR_ID from  "org.apache.myfaces.validator.Equal"
  to " com.oc.validators.MyValidator";

and created tld
<tag>
      <name>validateFromThrue</name>
 
<tag-class>com.oc.itworx.HR.validators.FromThrueValidatorTag</tag-class> 
      <body-content>JSP</body-content>
      <description>
            A custom validator for validations against foreign component
values.

        Unless otherwise specified, all attributes accept static values or
EL expressions. 
        </description>
      <!--
        This attribute indicates an alternate validation error message
format string to display.
        -->
      <attribute>
         <name>message</name> 
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
         <description>
                alternate validation error message format string
            </description> 
      </attribute>
      <attribute>
         <name>for</name>
         <required>true</required>
         <rtexprvalue>false</rtexprvalue>
         <description> 
                the id of the foreign component, which is needed for the
validation
            </description>
      </attribute>
   </tag>

but I got the following exception
javax.faces.FacesException : Unknown validator id
'com.oc.validators.MyValidator'

--
Ali Abdel-Aziz
http://www.aliabdelaziz.com
http://aabdelaziz.blogspot.com 

Reply via email to