From commons-dev-return-7975-qmlist-jakarta-archive-commons-dev=jakarta.apache.org@jakarta.apache.org Wed May 15 15:52:40 2002 Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 36849 invoked from network); 15 May 2002 15:52:39 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 15 May 2002 15:52:39 -0000 Received: (qmail 20307 invoked by uid 97); 15 May 2002 15:51:42 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 20204 invoked by uid 97); 15 May 2002 15:51:41 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 20175 invoked by uid 98); 15 May 2002 15:51:40 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Message-ID: <20020515155134.17106.qmail@web20409.mail.yahoo.com> Date: Wed, 15 May 2002 08:51:34 -0700 (PDT) From: David Winterfeldt Subject: Re: [Commons-Validator] required validation type To: Jakarta Commons Developers List In-Reply-To: <20020513235432.38758.qmail@web21505.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N You can create your own validators in the xml file. Just copy the required validator definition you are using and have it point to your own method. Then you could have the validation always return true if the field doesn't exist in the request object. public boolean validateConditionalRequired(Object bean, Field field, HttpServletRequest request) { if (request.getParameter(field.getProperty()) != null) { // check for required conditions } else { return true; } } David --- Eric Beaumier wrote: > Hi, I post it again ... > > > Actually the validateRequired use the generic method > isBlankOrNull for consequence, if the INPUT text > field > is not in the
it prompt an error "is > required". > > Could we have another type (ex: "notblank") allowing > > the validation only if present? Because to avoid > recreation of the same definition in > validation.xml with the field or not ... > > Because we reuse the in validation.xml for > different JSP page ... treated the same fields name. > > > Thanks. > > > __________________________________________________ > Do You Yahoo!? > LAUNCH - Your Yahoo! Music Experience > http://launch.yahoo.com > > -- > To unsubscribe, e-mail: > > For additional commands, e-mail: > > __________________________________________________ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com -- To unsubscribe, e-mail: For additional commands, e-mail: