We have a similar situation with our validations. We created our own
validators to handle those situations. For the javascript, we cloned the
javascript for the validation and added logic to apply the validation when
a field was populated - very easy. For the server-side validation, our
java class first insured that the field was not blank, and then invoked the
appropriate from the Struts validator, also very easy.
Nick
|---------+----------------------------->
| | "Kalra, Ashwani" |
| | <[EMAIL PROTECTED]|
| | gemini.com> |
| | |
| | 06/11/2004 09:56 |
| | AM |
| | Please respond to |
| | "Struts Users |
| | Mailing List" |
| | |
|---------+----------------------------->
>------------------------------------------------------------------------------------------------------------------------------|
|
|
| To: Struts Users Mailing List <[EMAIL PROTECTED]>
|
| cc:
|
| Subject: RE: validation for optional fields
|
>------------------------------------------------------------------------------------------------------------------------------|
I am validating using validator and working on Struts 1.1
-----Original Message-----
From: Axel Seinsche [mailto:[EMAIL PROTECTED]
Sent: Friday, June 11, 2004 7:24 PM
To: Struts Users Mailing List
Subject: Re: validation for optional fields
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Our name has changed. Please update your address book to the following
format: "[EMAIL PROTECTED]".
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]