Yes, but I would think that it would only be run after the first validation
(the requiredif) runs.  Is that not a correct assumption?  Do I need to add
anything to the exists validation to make it so?  In your example if the
requiredif fails, does it still try to run the next validations....?



Jeremy Weber                    
[EMAIL PROTECTED]


-----Original Message-----
From: Greg Murray [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 4:20 PM
To: Struts Users Mailing List
Subject: RE: RequiredIf Example Request


I'm not sure "exists" is a standard validation rule.  Did you define it
yourself?

-----Original Message-----
From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 2:00 PM
To: 'Struts Users Mailing List'
Subject: RE: RequiredIf Example Request


Thank you , thank you, thank you!

I misspoke when I said checkboxs, its a radio button, like this...

        
<tr>
        <td class="mandatory"><bean:message
key="appserver.usesecure.displayname"/></td>
        <td><html:radio property="useSecure" value="true"
onclick="showSecureOptions('true');"/> Yes<br>
        <html:radio property="useSecure" value="false"
onclick="showSecureOptions('false');"/> No</td>

</tr>

                         <field property="sslKeyStore"
depends="requiredif,exists">
                               <arg0
key="appserver.sslkeystore.displayname"/>
                               <var>
                                        <var-name>field[0]</var-name>
                                        <var-value>useSecure</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>true</var-value>
                                </var>
                        </field>


>From what I can tell, this looks like it will work... But it doesnt.
However, this is the kicker... If I remove exists from depends, it acts as
it should.  Now I figured that exists would only be called if requiredif
passed.  Any thoughts?






Jeremy Weber                    
[EMAIL PROTECTED]


-----Original Message-----
From: Greg Murray [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 3:26 PM
To: Struts Users Mailing List
Subject: RE: RequiredIf Example Request


If you're just requesting an example of something, here's what I'm currently
using:

      <field property="studentId"
depends="requiredif,integer,minlength,maxlength">
        <msg name="requiredif" key="errors.msg.studentIDorNameRequired"/>
        <msg name="integer" key="errors.msg.invalidStudentID"/>
        <msg name="minlength" key="errors.msg.invalidStudentID"/>
        <msg name="maxlength" key="errors.msg.invalidStudentID"/>
        <var>
          <var-name>minlength</var-name>
          <var-value>9</var-value>
        </var> 
        <var>
          <var-name>maxlength</var-name>
          <var-value>9</var-value>
        </var>
        <var>
          <var-name>field[0]</var-name>
          <var-value>lastName</var-value>
        </var>
        <var>
          <var-name>field-test[0]</var-name>
          <var-value>NULL</var-value>
        </var>
      </field>

This makes studentId required if lastName is NULL.  If I also wanted to add
a requirement to make studentId required if firstName was null, I'd add the
following to the above:

        <var>
          <var-name>field[1]</var-name>
          <var-value>lastName</var-value>
        </var>
        <var>
          <var-name>field-test[1]</var-name>
          <var-value>NULL</var-value>
        </var>

The conditions you can have are NULL, NOTNULL, and EQUAL.

I haven't used this with checkboxes yet, but I think you'd probably have
each of your three fields use requiredif, and use something like the
following to make it depend on the checkbox:

        <var>
          <var-name>field[0]</var-name>
          <var-value>checkboxFieldName</var-value>
        </var>
        <var>
          <var-name>field-test[0]</var-name>
          <var-value>NOTNULL</var-value>
        </var>

The fact that the example was using indicies screwed me up for a while too
until I took a look at the source code for FieldChecks.

GM

-----Original Message-----
From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 12:57 PM
To: 'Struts Users Mailing List' (E-mail)
Subject: RequiredIf Example Request


I requested this before and have not recieved a response...:(  Any takers
out there?  Currently I am having a heck of time figuring out how to make
this work...  

I have checked out all the online examples, but I am unclear as to what this
stuff means...

If you have this in your struts-config.xml...

<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>

My form properties look like...

<form-bean name="InstallConfigurationFormBean"
        type="com.vendorsite.install.beans.InstallConfigurationFormBean"/>


So I am missing the type and initial fields.  Can anybody help me see the
light?  I need a checkbox to control whether or not 3 addiotional text
fields are required.

Thanks,

Jeremy Weber                    
[EMAIL PROTECTED]

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


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

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


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

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

Reply via email to