You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kalra, Ashwani" <as...@capgemini.com> on 2004/06/11 15:50:31 UTC

validation for optional fields

hi,
how can I validate an optional field. ie validate only if there is some
value in it. For example. I want to validate a field which should of type
int.But  it should be validated only if use has entered some value in it.

 Thanks & Regds 
 Ashwani Kalra 
 http://www.geocities.com/ashwani_kalra/






Our name has changed.  Please update your address book to the following format: "recipient@capgemini.com".

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: validation for optional fields

Posted by Axel Seinsche <st...@seinsche.net>.
Kalra, Ashwani wrote:

>hi,
>how can I validate an optional field. ie validate only if there is some
>value in it. For example. I want to validate a field which should of type
>int.But  it should be validated only if use has entered some value in it.
>  
>
hi,

if you are validating in your form or action class you can check if the 
field is not empty (!= null or !equals("") and then check for correct 
int value.

Axel

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org