You are completely correct Matt. In our situation, there were other
reasons that led us to create our own versions of the struts validations -
I won't bore anyone with those details. The point I was really getting at,
is that specialized applications of the struts validations can be easily
accomplished. The need to "extend" a struts validation has to be there.
In our app, we use a combination of the canned struts validations and some
of our own validations that apply logic that is specialized for our
specific needs.
I probably read too much into the question... :-)
Nick
|---------+---------------------------->
| | "Matt Bathje" |
| | <[EMAIL PROTECTED]|
| | > |
| | |
| | 06/11/2004 10:39 |
| | AM |
| | Please respond to|
| | "Struts Users |
| | Mailing List" |
| | |
|---------+---------------------------->
>------------------------------------------------------------------------------------------------------------------------------|
|
|
| To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
|
| cc:
|
| Subject: Re: validation for optional fields
|
>------------------------------------------------------------------------------------------------------------------------------|
Maybe I'm missing something here, but why can't you just setup the
validation to do the integer validation without the required validation?
Integer does not depend on the required validation, so it should be fine -
if there is nothing in the field the validation will just return true.
Sample code in validation.xml would be:
<field property="test" depends="integer">
<arg0 key="label.test" />
</field>
Matt
----- Original Message -----
From: "Nicholas L Mohler" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, June 11, 2004 9:34 AM
Subject: RE: validation for optional fields
>
>
>
>
>
>
> 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]
>
---------------------------------------------------------------------
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]