You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Mike Tedesco <Mi...@skillsoft.com> on 2004/05/26 15:01:02 UTC
Validation on An optional field that if supplied passes a validation
Can someone tell me how I set up a form validation in my xml that can be optional (i.e. passed as null). But if it is supplied then I can perform the validation
<field
property="email2"
depends="email">
<arg0 key="ilt.Email2"/>
</field>
Like above I want only the email validation to be performed if the field is not null.
-- Thanks
Re: Validation on An optional field that if supplied passes a validation
Posted by David Graham <gr...@yahoo.com>.
If you're using this from Struts, the FieldChecks methods only run the
validation if the value is supplied so using just email will work for
optional fields (use required and email for non-optional fields).
If you're using this in a non-Struts app you need to front EmailValidator
with your own method that only runs the validation when the value is not
null similar to FieldChecks. We're currently working on adding fully
functional validators so you won't have to do this in the future.
David
--- Mike Tedesco <Mi...@skillsoft.com> wrote:
> Can someone tell me how I set up a form validation in my xml that can be
> optional (i.e. passed as null). But if it is supplied then I can perform
> the validation
>
> <field
>
> property="email2"
>
> depends="email">
>
> <arg0 key="ilt.Email2"/>
>
> </field>
>
>
>
> Like above I want only the email validation to be performed if the field
> is not null.
>
>
>
> -- Thanks
>
>
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org