Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 47195 invoked from network); 13 Sep 2003 09:44:11 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 13 Sep 2003 09:44:11 -0000 Received: (qmail 60834 invoked by uid 500); 13 Sep 2003 09:43:39 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 60806 invoked by uid 500); 13 Sep 2003 09:43:39 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 60793 invoked from network); 13 Sep 2003 09:43:39 -0000 Received: from unknown (HELO smtp804.mail.sc5.yahoo.com) (66.163.168.183) by daedalus.apache.org with SMTP; 13 Sep 2003 09:43:39 -0000 Received: from adsl-64-167-238-10.dsl.scrm01.pacbell.net (HELO lollimail.com) (kbaltz@pacbell.net@64.167.238.10 with plain) by smtp-sbc-v1.mail.vip.sc5.yahoo.com with SMTP; 12 Sep 2003 16:55:04 -0000 Message-ID: <3F61FA60.6040709@lollimail.com> Date: Fri, 12 Sep 2003 09:54:56 -0700 From: "K.C. Baltz" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: rs1_8245a697bc0, rs2_446339ebb7d, rs3_cea8891783 MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: Validate only if the field exists using Commons Validator References: <3F6138F0.20606@lollimail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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 (kc.baltz@lollimail.com) 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 >>>To: Jakarta Commons Users List ,radsforyou@lycos.com >>>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 (radsforyou@lycos.com) 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: commons-user-unsubscribe@jakarta.apache.org >>>>>For additional commands, e-mail: commons-user-help@jakarta.apache.org >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>--------------------------------------------------------------------- >>>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org >>>>For additional commands, e-mail: commons-user-help@jakarta.apache.org >>>> >>>> >>>> >>>> >>>> >>>> >>> >>>____________________________________________________________ >>>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: commons-user-unsubscribe@jakarta.apache.org >>>For additional commands, e-mail: commons-user-help@jakarta.apache.org >>> >>> >>> >>> >>> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org >>For additional commands, e-mail: commons-user-help@jakarta.apache.org >> >> >> >> >> > >--------------------------------------------------------------------- >To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: commons-user-help@jakarta.apache.org > > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org