You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ne...@srb-intl.com on 2003/04/28 20:06:29 UTC

something about validator

Hi

If I have defined actionForm:

   ===================================================================================
   public class MyActionForm extends ValidatorActionForm {
      public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
         return super.validate(mapping, request);
      }
   }
   ===================================================================================


and defined validator:

   ===================================================================================
   package framework.utils;
   public class Validator implements java.io.Serializable
   {
      public static boolean validateDateXYZ(java.lang.Object bean,
                                            org.apache.commons.validator.ValidatorAction va,
                                            org.apache.commons.validator.Field field,
                                            org.apache.struts.action.ActionErrors errors,
                                            javax.servlet.http.HttpServletRequest request) {
          throw new RuntimeException("I was called!");
      }
   }
   ===================================================================================

and declared it in validation-rules.xml:

   ===================================================================================
      <validator name="dateXYX"
            classname="framework.util.Validator"
               method="validateDateXYZ"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionErrors,
                       javax.servlet.http.HttpServletRequest"
                  msg="errors.dateXYZ">

         <javascript><![CDATA[
            function validateDateXYZ(form) {
               alert('XYZ');
            }
         </javascript>
      </validator>
   ===================================================================================

it happens so that JScript function is called during client-side validation, but never 
called on server-side validations. How that come?

ps. I was looking at this issue week long - no way, need help.

please,
~nn

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