Struts validation for combine form fields validation

Discussion in 'Java' started by Sumith Mathur, Sep 23, 2004.

  1. I'm using dynaForm and validation plug-in, I trying to figure out how
    can I do a date validation if on the form I've date as 3 different
    form fields for Month, Day and Year.
    Is there a way, I can declare in the validation.xml to combine Month,
    Day and Year fields and validate for validDate.

    Thanks

    Sumith

    -----------------------------------
    <!-- validation.xml -->

    <form name="userProfileForm">

    <field property="firstName"
    depends="required,maxlength">
    <arg0 key="user.firstName" />
    <arg1 key="${var:maxlength}" name="maxlength"
    resource="false" />
    <var>
    <var-name>maxlength</var-name>
    <var-value>14</var-value>
    </var>

    </field>
    <field property="lastName"
    depends="required,maxlenght">
    <arg0 key="user.lastName" />
    <arg1 key="${var.maxlenght}" name="maxlength"
    resource="false" />
    <var>
    <var-name>maxlenght</var-name>
    <var-value>20</var-value>
    </var>
    </field>
    <field property="middleName" depends="required">
    <arg0 key="user.middleName" />
    </field>
    <field property="dateOfBirthMonth" depends="required">
    <arg0 key="user.dOBMonth" />
    </field>
    <field property="dateOfBirthDay" depends="required">
    <arg0 key="user.dOBDay" />
    </field>
    <field property="dateOfBirthYear" depends="required">
    <arg0 key="user.dOBYear
    </field>

    ----------------------------------------------------
    <!--struts-config.xml-->
    <form-beans>
    <form-bean name="userProfileForm"
    type="org.apache.struts.validator.DynaValidatorForm" >
    <form-property type="java.lang.String" name="firstName"/>
    <form-property type="java.lang.String" name="middleName"/>
    <form-property type="java.lang.String"
    name="dateOfBirthMonth"/>
    <form-property type="java.lang.String" name="dateOfBirthDay"/>
    <form-property type="java.lang.String" name="dateOfBirthYear"/>
    </form-bean>
    </form-beans>
     
    Sumith Mathur, Sep 23, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. CuMPeEWeEr [No MCSD]

    DataGrid problem - Combine 2 fields

    CuMPeEWeEr [No MCSD], Jan 6, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    681
    Lars Netzel
    Jan 7, 2005
  2. =?Utf-8?B?RGFiYmxlcg==?=

    conditionaly combine databound fields?

    =?Utf-8?B?RGFiYmxlcg==?=, Mar 30, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    2,435
    brislic2
    Dec 21, 2009
  3. Merlijn
    Replies:
    0
    Views:
    3,495
    Merlijn
    Mar 24, 2006
  4. yawnmoth
    Replies:
    2
    Views:
    479
    Peter Flynn
    Aug 18, 2008
  5. bnp
    Replies:
    4
    Views:
    355
Loading...

Share This Page