Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 82738 invoked from network); 30 Sep 2004 14:29:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 30 Sep 2004 14:29:04 -0000 Received: (qmail 97223 invoked by uid 500); 30 Sep 2004 14:27:47 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 97064 invoked by uid 500); 30 Sep 2004 14:27:45 -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 97018 invoked by uid 99); 30 Sep 2004 14:27:44 -0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=DNS_FROM_RFC_POST X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [65.54.247.5] (HELO hotmail.com) (65.54.247.5) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 30 Sep 2004 07:27:43 -0700 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 30 Sep 2004 07:14:07 -0700 Received: from 206.66.2.100 by by2fd.bay2.hotmail.msn.com with HTTP; Thu, 30 Sep 2004 14:13:16 GMT X-Originating-IP: [206.66.2.100] X-Originating-Email: [commons101x@hotmail.com] X-Sender: commons101x@hotmail.com From: "struts commons" To: commons-user@jakarta.apache.org Bcc: Subject: RE: new (custom) validation (revised) Date: Thu, 30 Sep 2004 09:13:16 -0500 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 30 Sep 2004 14:14:07.0710 (UTC) FILETIME=[BFBBB7E0:01C4A6F7] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N sorry, I am using the following before the return from my new class (see below) if ( !bValid ) { errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field)); } >From: "struts commons" >Reply-To: "Jakarta Commons Users List" >To: commons-user@jakarta.apache.org >Subject: new (custom) validation >Date: Thu, 30 Sep 2004 08:49:18 -0500 > >Hello all, >I hope this question is not to remedial but I am really trying to >understand what's wrong here. >I am trying to create a new validator for 'time'. I am basically parsing >the string down to test components that make up the user input. I have >followed numerous examples from books and internet to come up with the code >below. >My new class seems to be the problem as I can get the client side to >function and return a valid boolean but it will not give me the resource >message either client side or server side. I am able to put alert message >in my javascript and get those but it will not return with the .properties >message I wrote. All other validation (date, required, etc.. etc..) works >fine both client and server. >I included the code (minus the logic, I'm sure that is works) where I >thought the problem may lie, but I'm new to Struts and fairly new to Java >so if you need more I would be more than happy to oblige(just tell me what >would help) but the rest of it seemed fairly standard and not where the >problem may be. >Thanks in advance. >Jim > >/************************************************************ >new class I created > >package com.gli.validator; > >import java.io.Serializable; >import javax.servlet.http.HttpServletRequest; >import org.apache.commons.validator.Field; >import org.apache.commons.validator.ValidatorAction; >import org.apache.struts.action.ActionErrors; >import org.apache.commons.validator.GenericValidator; >import org.apache.commons.validator.ValidatorUtil; >import org.apache.struts.util.StrutsValidatorUtil; > >public class GLIValidator implements Serializable { > /** > * > **/ > public GLIValidator(){ > } > > public static boolean validateTime(Object bean, ValidatorAction va, Field >field, > ActionErrors errors, HttpServletRequest request) { > > //processing to validate (left out to shorten email but it works) > // ValidatorUtil.getValueAsString(bean, field.getProperty() ) > // > // if ( !bValid ) { errors.add(field.getKey(), StrutsValidatorUtil.getActionError(request, va, field)); } > return bValid; > } > >} > >***************************************************************/ > >/************************************************************** >relevant portion of validator-rules.xml > > classname="com.gli.validator.GLIValidator" > method="validateTime" > methodParams="java.lang.Object, > org.apache.commons.validator.ValidatorAction, > org.apache.commons.validator.Field, > org.apache.struts.action.ActionErrors, > javax.servlet.http.HttpServletRequest" > depends="required" > msg="errors.time" > jsFunctionName="TimeValidations"> > > function validateTime(form){ > > // process to validate client side (left out to shorten email >but it works) > return bValid; > } ]]> > > >/************************************************************** > >/************************************************************** >relevant portion of validation.xml > >
> > > > datePatternStrict > MM/dd/yyyy > > > > > >***************************************************************/ > >_________________________________________________________________ >Express yourself instantly with MSN Messenger! Download today - it's FREE! >hthttp://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: commons-user-help@jakarta.apache.org > _________________________________________________________________ On the road to retirement? Check out MSN Life Events for advice on how to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org