facebook

Struts 1.2 DynaValidatorForm validators and arrays…

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #267193 Reply

    David Orriss Jr
    Participant

    Does the Struts DynaValidatorForm work with Arrays of objects? Here’s what I have…

    In my <form-bean> I have as follows:

      <form-beans >
        <form-bean name="userPromptForm" type="org.apache.struts.validator.DynaValidatorForm">
          <form-property name="phone" type="java.lang.String[]" />
        </form-bean>
      </form-beans>

    I have the validator defined:

    
    <form-validation>
        <formset>
            <form name="userPromptForm">
                <field property="phone" depends="required">
                    <arg0 key="prompt.phone"/>
                </field>
            </form>
        </formset>
    </form-validation>

    And my form is defined with all the appropriate goodies and a <logic:iterate> tag to display my array of “phone” fields… But the generated code doesn’t stop the fields being left blank.

    
        <html:form action="/done" method="post"  onsubmit="return validateUserPromptForm(this)">
            <table border=1 width=598 cellspacing=1 cellpadding=0>
                <tr>
                    <td>
                        <logic:iterate id="promptdata" name="prompts" scope="session">
                            <tr>
                                <td>
                                       <bean:write name ="promptdata" property="name"  />
                                </td>
                                <td align="right" width="25%">
                                     <html:text name="promptdata" property="phone" />
                                </td>
                            </tr>
                        </logic:iterate>
                    </td>
                </tr>
            </table>
            <html:errors/>
            <html:submit/><html:reset/>
            <!-- Begin Validator Javascript Function-->
            <html:javascript formName="userPromptForm" />
            <!-- End of Validator Javascript Function-->
        </html:form>

    So is this just not possible in Struts 1.2? What about 1.3? Help…?

    #267196 Reply

    Riyad Kalla
    Member

    Don’t know off hand Dave, sorry.

    Anybody else?

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Struts 1.2 DynaValidatorForm validators and arrays…

You must be logged in to post in the forum log in