OK, good to know the mask doesn't need to allow for empty strings. Also, I'm not familiar with the differences that Struts introduces.

That being said, I've also had problems before where validator-rules.xml had a bunch of the validators set to depend on "required". So even though the depends attribute for my field didn't say "required", they were being required. I'm not sure if someone on my project changed it that way or if it came stock. Something to think about if you find fields being required when you don't expect it.

K.C.

Gary Shea wrote:

Just to keep things straight, discussion of the "required" and "mask"
validators is of course only applicable to Struts.  WRT "mask", you're
slightly wrong (I think!): if "depends" does not include "required", the
"mask" test is never done unless the field is non-null and non-empty.
The "mask" test does not need to allow for empty strings.

Gary

[2003-09-11 20:09 -0700] K.C. Baltz ([EMAIL PROTECTED]) wrote:


I think that as long as you have the "depends" attribute for the field set to "mask", but not "required", and your mask allows empty strings, you should be set to go. Otherwise, you'll probably have to use the "requiredif" dependency.

K.C.

Radhika Menon wrote:



Will it be possible to send an example on how to configure it in the validation.xml?

Thanks
Radhika
--

--------- Original Message ---------

DATE: Wed, 10 Sep 2003 17:37:37
From: Gary Shea <[EMAIL PROTECTED]>
To: Jakarta Commons Users List <[EMAIL PROTECTED]>,[EMAIL PROTECTED]
Cc:






Well, I'm not exactly an expert on validator, but I just figured out the
answer to this question myself a couple days ago.  I'm using Struts, and
Struts valdiation uses commons validator.  Struts has its own plugin
validators, which explicitly check GenericValidator.isBlankOrNull() on the
field, and ignore the field if true.

I have followed the pattern in my plugin validators.

Gary

[2003-09-10 23:21 +0530] Radhika Menon ([EMAIL PROTECTED]) wrote:




Using Commons-Validator, is it possible to validate a field only if it exists on the 
form.
For example, I have a situation in which a "text" field gets generated only if a certain 
condition is true. What I want to do is, I want to check that if this field exists then, validate that it 
is numeric against a "mask" which is defined in validation.xml.

Is this possible?

Thanks in advance
Radhika



____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005

---------------------------------------------------------------------
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]







____________________________________________________________ Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail! http://login.mail.lycos.com/r/referral?aid=27005

---------------------------------------------------------------------
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]



Reply via email to