RE: Date validator does not ignore nulls

2005-05-06 Thread tarek.nabil
That's strange, because the way I understand it is just the opposite.
What I understand is if a validation depends on another validation, then
this validation should not be triggered unless the first one succeeds.
Actually, this makes sense, because it's useless to try to validate an
empty field to make sure it's a date.

But anyway, if this is the case, what do you suggest?

In my validations.xml, I did not specify that this field depends on the
required validation. I don't think changing the validator declaration
would help, since the problem is with the code itself.

Thanks

-Original Message-
From: Dave Newton [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 05, 2005 6:12 PM
To: Struts Users Mailing List
Subject: Re: Date validator does not ignore nulls

tarek.nabil wrote:

>  classname="org.apache.struts.util.StrutsValidator"
>   method="validateDate"
> 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.date"
>   jsFunctionName="DateValidations">
>
>Although the validator declares that it depends on required, so (as far

>as I understand) that means it should not be triggered if the value is 
>null or blank. Nevertheless, it is, and it shows the error that the 
>date is invalid. I checked the source for the class that performs the 
>validation, and obviously it adds the error to the errors collection if

>the value is null or blank. But I think it's not supposed to even get 
>called, because in the declaration of the validator, it says it depends

>on required.
>  
>
"Required" means the value must not be blank or null, right? So if a
validation depends on "required" that means that the value can't be
blank or null. So it _should_ be triggered on a blank or null.

Dave



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Date validator does not ignore nulls

2005-05-05 Thread Dave Newton
tarek.nabil wrote:
 
Although the validator declares that it depends on required, so (as far
as I understand) that means it should not be triggered if the value is
null or blank. Nevertheless, it is, and it shows the error that the date
is invalid. I checked the source for the class that performs the
validation, and obviously it adds the error to the errors collection if
the value is null or blank. But I think it's not supposed to even get
called, because in the declaration of the validator, it says it depends
on required.
 

"Required" means the value must not be blank or null, right? So if a 
validation depends on "required" that means that the value can't be 
blank or null. So it _should_ be triggered on a blank or null.

Dave

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Date validator does not ignore nulls

2005-05-05 Thread tarek.nabil
Hi everyone,

For some sort of reason, I'm using Struts version 1.1b2. I have a search
screen where the user can search using some date fields. I put the
following field declaration in my validations.xml file

   


 datePattern
 ${dateFormat}

   

The date validator is declared as follows in my validator-rules.xml
(without the JavaScript)

  

Although the validator declares that it depends on required, so (as far
as I understand) that means it should not be triggered if the value is
null or blank. Nevertheless, it is, and it shows the error that the date
is invalid. I checked the source for the class that performs the
validation, and obviously it adds the error to the errors collection if
the value is null or blank. But I think it's not supposed to even get
called, because in the declaration of the validator, it says it depends
on required.

Is this a bug in this old version, or am I doing something wrong?

Any help is appreciated.

Thanks,
Tarek Nabil

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]