You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Ali Abdel-Aziz Ali <ro...@gmail.com> on 2006/07/26 12:52:03 UTC
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
Re: Custom Validation Problem
Posted by Ali Abdel-Aziz Ali <ro...@gmail.com>.
thanx, I forget to register it.
it works now.
On 7/26/06, Julian Ray <ju...@yahoo.com> wrote:
>
> Did you register the validator in the faces-xml file?
>
> -----Original Message-----
> From: Ali Abdel-Aziz Ali [mailto:robinhoo.2006@gmail.com]
> 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
>
>
--
Ali Abdel-Aziz
http://www.aliabdelaziz.com
http://aabdelaziz.blogspot.com
RE: Custom Validation Problem
Posted by Julian Ray <ju...@yahoo.com>.
Did you register the validator in the faces-xml file?
-----Original Message-----
From: Ali Abdel-Aziz Ali [mailto:robinhoo.2006@gmail.com]
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