struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Louis Leung <louis.le...@sun.com>
Subject Re: Validator and Dates
Date Wed, 24 Apr 2002 18:11:13 GMT
u can make a new class that does custome validation and configure the validator
to point to that method

example :
say this ValidatorExtension class is in package com.A.Z

public class ValidatorExtension {
    public static boolean validateDate(Object bean,
        ValidatorAction va, Field field,
        ActionErrors errors,
                             HttpServletRequest request, ServletContext
application) {
            ...
    }
}


in your validation-rules.xml, u will put

      <validator name="date"
                 classname="com.A.Z.ValidatorExtension"
                 method="validateDate"
   msg="errors.date"
                 jsFunctionName="dateValidations">
         <javascript><![CDATA[
            function validateDateCustom {
               .......
            }
         </javascript>
      </validator>


in your validation.xml, u will put this in your form validation definition

<field depends="date"> ... </field>







"Juan Alvarado (Struts List)" wrote:

> Does anyone know if there is a date validator that can be plugged into the
> struts validator. What I need is to make sure that a user enters a valid
> date range. In other words the date range of november 4th, 1970 to november
> 4th 1969 is invalid.
>
> Thanks in advance
>
> **********************************************
> Juan Alvarado
> Internet Developer -- Manduca Management
> (786)552-0504
> jalvarado@manduca.com
> AOL Instant Messenger: juan2000@aol.com
>
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message