thanks Laurie! my question was finally understood :-)
 
by the way you said: "and then do the data validation server-side in the 
form-bean's validate() method"
 
As much as I understand - using Validator (not via JavaScript) is "server side" 
as using  form-bean's validate() method. Am I right?
 
thanks
Rivka

________________________________

מאת: news בשם Laurie Harper
נשלח: ב 4/10/2006 2:20 AM
אל: user@struts.apache.org
נושא: Re: Validator rule question



The problem is that validwhen's expression syntax isn't powerful enough
to describe date constraints. The best you could do with validwhen is to
say 'if field X has a value, this field must have a value too' and then
do the data validation server-side in the form-bean's validate() method.

The alternative is to create a custom validation rule, perhaps based on
the existing date validation rule, that also does the inter-field checking.

L.

Bart Busschots wrote:
> Hi,
>
> The example is in the archives of the mailing list no more than a few
> days ago. I'm not at work now so I don't have it in front of me to
> re-send it. The example does not exactly solve your identical problem
> but it does show how you can use validwhen to apply logic based on the
> value of another field in your form which is what you want to do. The
> actual logic can be pretty much anything, if it evaluates to true then
> the field is valid, if false it is not.
>
> Bart.
>
> Rivka Shisman wrote:
>> Hi Bart,
>>
>> I still can't see how the "validwhen" solves my original problem.
>> Can you please attach your example of solving it with "validwhen"?
>>
>> Thanks
>> Rivka
>>
>>
>> -----Original Message-----
>> From: Bart Busschots [mailto:[EMAIL PROTECTED] Sent: Sunday, April 09,
>> 2006 4:09 PM
>> To: Struts Users Mailing List
>> Subject: Re: Validator rule question
>>
>> Rivka Shisman wrote:
>> 
>>> Hi Quinn,
>>>
>>> As much as I understand the "validwhen" is more like an enhanced
>>> "requiredif", but I need that the "date" rule on my property be
>>>    
>> checked
>> 
>>> only when my other property has value "X". I don't think the
>>>    
>> "validwhen"
>> 
>>> can solve this.
>>>
>>> Am I right?
>>>      
>> No, the valid when is specifically designed to validate fields based
>> on the values of other fields. I posted an example of that a few days
>> ago to this list.
>>
>> Bart.
>> 
>>> Rivka
>>>
>>> -----Original Message-----
>>> From: Quinn Stone [mailto:[EMAIL PROTECTED] Sent:
>>> Saturday, April 08, 2006 8:06 PM
>>> To: 'Struts Users Mailing List'
>>> Subject: RE: Validator rule question
>>>
>>> Rivka, look into the "validwhen" validation. I think that should do
>>>    
>> the
>> 
>>> trick.
>>>
>>> Q
>>> -----Original Message-----
>>> From: Rivka Shisman [mailto:[EMAIL PROTECTED] Sent: Saturday, April
>>> 08, 2006 9:24 AM
>>> To: Struts Users Mailing List
>>> Subject: Validator rule question
>>>
>>>
>>> Hello Friends,
>>>
>>> 
>>>
>>> I have a DynaValidatorForm in which there 2 String properties: action
>>> and student_birth_date.
>>>
>>> I have a date validation like this:
>>>
>>> 
>>>
>>>             <field
>>>
>>>                 property=" student_birth_date"
>>>
>>>                 depends="required,date">
>>>
>>>                     <arg key="Student birth date" resource="false"
>>> position="0"/>
>>>
>>>                     <arg key="MM/YY" resource="false" position="1"/>
>>>
>>>                               <var>
>>>
>>>                           <var-name>datePatternStrict</var-name>
>>>
>>>                           <var-value>MM/yy</var-value>
>>>
>>>                               </var>                 
>>>             </field>
>>>
>>> 
>>>
>>> 
>>>
>>> I need that the validation above to depend on the value of the
>>>    
>> "action"
>> 
>>> property in the Form (i.e. if action equals "create" or "update" then
>>>    
>> do
>> 
>>> the validation, else ignore it)
>>>
>>> 
>>>
>>> How can I do that?
>>>
>>> 
>>>
>>> Thanks
>>>
>>> Rivka
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>>      
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>>  


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




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

Reply via email to