Bruce,

I have experienced the same bug. The only thing we can do is not to use
client side validation with requiredif fields :-(. 

I am not sure this bug has been reported in bugzilla or not, I don't
have time today to search or post but we should.

Cheers,

Greg

-----Original Message-----
From: Bruce Geerdes [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 21, 2003 4:55 PM
To: Struts Users Mailing List
Subject: Re: 1.1 rc1 -Validator: Conditionally required fields.

I no longer get the javascript client-side validation.  It falls through

to the server.  (*All* validation, even for fields other than 
"phoneBody".)  If I remove the following lines, however, client-side 
validation returns

                <!-- requiredif variables -->                     
                <var>
                    <var-name>field[0]</var-name>
                    <var-value>version</var-value>
                </var>
                <var>
                    <var-name>fieldTest[0]</var-name>
                    <var-value>EQUAL</var-value>
                </var>
                <var>
                    <var-name>fieldValue[0]</var-name>
                    <var-value>4</var-value>
                </var>

(Sorry I can't be more specific; I'm not a js expert, or even
intermediate.)

Bruce


David Graham wrote:

> How does your js break?
>
> David
>
>
>
>> From: Bruce Geerdes <[EMAIL PROTECTED]>
>> Reply-To: "Struts Users Mailing List"
<[EMAIL PROTECTED]>
>> To: [EMAIL PROTECTED]
>> Subject: Re: 1.1 rc1 -Validator: Conditionally required fields.
>> Date: Fri, 21 Mar 2003 12:28:37 -0700
>>
>> Did this solve the problem of having both requiredif and mask 
>> depends? I downloaded yesterday's nightly but trying to add a 
>> requiredif still breaks my javascript validation.
>>
>> Actually, I've narrowed my problem down to just adding the requiredif

>> variables (field[0], fieldTest[0], fieldValue[0]).  Or am I doing 
>> something else wrong?
>>
>>         <field    property="phoneBody"
>>                   depends="required,mask"
>>                   page="3">
>>                 <msg name="mask" key="validation.format1"/>
>>                 <arg0 key="account.phone"/>
>>                 <arg1 key="999-9999" 
>> resource="false"/>                                    <var>
>>                   <var-name>mask</var-name>
>>                   <var-value>${phoneBody}</var-value>
>>                 </var>                       <!-- requiredif 
>> variables -->                      <var>
>>                     <var-name>field[0]</var-name>
>>                     <var-value>version</var-value>
>>                 </var>
>>                 <var>
>>                     <var-name>fieldTest[0]</var-name>
>>                     <var-value>EQUAL</var-value>
>>                 </var>
>>                 <var>
>>                     <var-name>fieldValue[0]</var-name>
>>                     <var-value>4</var-value>
>>                 </var>
>>         </field>
>>
>> Bruce
>>
>>
>> David Graham wrote:
>>
>>> You can't use field-* anymore.  It generates invalid javascript 
>>> variables so I changed all of those variables to camel case and 
>>> removed the "-".  Also, can you choose a different topic for the 
>>> example?  This one is kind of distracting :-).
>>>
>>> David
>>>
>>>
>>>
>>>> From: "James Turner" <[EMAIL PROTECTED]>
>>>> Reply-To: "Struts Users Mailing List"
<[EMAIL PROTECTED]>
>>>> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>>>> Subject: RE: 1.1 rc1 -Validator: Conditionally required fields.
>>>> Date: Thu, 20 Mar 2003 11:16:40 -0500
>>>>
>>>> That would be me.  For the moment, here's a simple example of a
>>>> requiredif:
>>>>
>>>> Let's say you have three fields in your form, Sex,
dateOfLastMamogram,
>>>> and testResult.  If sex is 'F' or 'f', dateOfLastMamogram should be
>>>> required. If dateOfLastMamogram is not empty, testResult is
required.
>>>> Here the validator XML for it:
>>>>
>>>> <form name="medicalStatusForm">
>>>>
>>>> <field
>>>>     property="dateOfLastMamogram" depends="requiredif">
>>>>   <arg0 key="medicalStatusForm.dateOfLastMamogram.label"/>
>>>>   <var>
>>>>     <var-name>field[0]</var-name>
>>>>     <var-value>sex</var-value>
>>>>   </var>
>>>>   <var>
>>>>     <var-name>field-test[0]</var-name>
>>>>     <var-value>EQUAL</var-value>
>>>>   </var>
>>>>   <var>
>>>>     <var-name>field-value[0]</var-name>
>>>>     <var-value>F</var-value>
>>>>   </var>
>>>>   <var>
>>>>     <var-name>field[1]</var-name>
>>>>     <var-value>sex</var-value>
>>>>   </var>
>>>>   <var>
>>>>     <var-name>field-test[1]</var-name>
>>>>     <var-value>EQUAL</var-value>
>>>>   </var>
>>>>   <var>
>>>>     <var-name>field-value[1]</var-name>
>>>>     <var-value>f</var-value>
>>>>   </var>
>>>>   <var>
>>>>     <var-name>field-join</var-name>
>>>>     <var-value>OR</var-value>
>>>>   </var>
>>>> </field>
>>>>
>>>> <field
>>>>     property="testResult" depends="requiredif">
>>>>   <arg0 key="medicalStatusForm.testResult.label"/>
>>>>   <var>
>>>>     <var-name>field[0]</var-name>
>>>>     <var-value>dateOfLastMamogram</var-value>
>>>>   </var>
>>>>   <var>
>>>>     <var-name>field-test[0]</var-name>
>>>>     <var-value>NOTNULL</var-value>
>>>>   </var>
>>>> </field>
>>>> </form>
>>>>
>>>> I've added this example to the Validator dev guide and the Struts 
>>>> FAQ to
>>>> hopefully reduce the number of these queries.
>>>>
>>>> > -----Original Message-----
>>>> > From: David Graham [mailto:[EMAIL PROTECTED]
>>>> > Sent: Thursday, March 20, 2003 10:58 AM
>>>> > To: [EMAIL PROTECTED]
>>>> > Subject: Re: 1.1 rc1 -Validator: Conditionally required fields.
>>>> >
>>>> >
>>>> > >Are there any other examples of using conditionally required
>>>> > fields for
>>>> > >the validator? I find the example here a bit confusing.
>>>> >
>>>> > You're not the only one.  I still haven't figured it out
>>>> > although I haven't
>>>> > spent much time with it.  A committer (can't remember which one)
has
>>>> > developed an easier validation method for this kind of thing.
>>>> >  We should be
>>>> > adding it for 1.2.
>>>> >
>>>> > >
>>>> > >http://jakarta.apache.org/struts/userGuide/dev_validator.html
>>>> > >
>>>> > >Specifically the part:
>>>> > ><form-bean
>>>> > >     name="dependentlistForm"
>>>> > >
type="org.apache.struts.webapp.validator.forms.ValidatorForm">
>>>> > >
>>>> > >     <form-property
>>>> > >         name="dependents"
>>>> > >         type="org.apache.struts.webapp.validator.Dependent[]"
>>>> > >         initial="{'','','','','','','','','','',''}"/>
>>>> > >     <form-property
>>>> > >         name="insureDependents"
>>>> > >         type="java.lang.Boolean"
>>>> > >         initial="false"/>
>>>> > >
>>>> > ></form-bean>
>>>> > >
>>>> > >'Where dependent is a bean that has properties lastName,
firstName,
>>>> > >dob, coverageType'
>>>> > >
>>>> > >Is 'dependent' referring to Dependent[] or dependentlistForm? If
>>>> > >Dependent[], I don't see this in the src. Or this something
>>>> > I need to
>>>> > >code? Thanks for any clarity you can offer.
>>>> > >
>>>> > >steve
>>>> > >
>>>> > >
>>>> > 
>>>>
>---------------------------------------------------------------------
>>>> > >To unsubscribe, e-mail:
[EMAIL PROTECTED]
>>>> > >For additional commands, e-mail: 
>>>> [EMAIL PROTECTED]
>>>> >
>>>> >
>>>> > _________________________________________________________________
>>>> > Help STOP SPAM with the new MSN 8 and get 2 months FREE*
>>>> > http://join.msn.com/?page=features/junkmail
>>>> >
>>>> >
>>>> > 
>>>>
---------------------------------------------------------------------
>>>> > 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]
>>>
>>>
>>>
>>>
>>> _________________________________________________________________
>>> The new MSN 8: advanced junk mail protection and 2 months FREE*  
>>> http://join.msn.com/?page=features/junkmail
>>>
>>>
>>>
---------------------------------------------------------------------
>>> 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]
>>
>
>
> _________________________________________________________________
> Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
> http://join.msn.com/?page=features/junkmail
>
>
> ---------------------------------------------------------------------
> 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