Hi,
When I want to retain validation.xml for validation of most of my fields on
the form. However, the rules for one particular field is too complex to be
done with just the validation.xml. I intend to check for it in the
validation form action. What I see is that the action form's validate
function is not getting called.

I believe that this should be supported.

DynaActionForm code: [ Note: This is extending DynaValidatorForm ]
-----------------------------------

public class StudentEnquiryDynaActionForm extends DynaValidatorForm
{
    public ActionErrors validate(ActionMapping actionMapping, ServletRequest
servletRequest)
    {
            System.out.println("**********************************In the
validation!**********************");
            return errors;
   }

}

--------------------------------------
struts-config.xml:

<form-bean name="studentEnquiryForm" type="
com.tuningfork.student.formobject.StudentEnquiryDynaActionForm">
       <form-property name="studentEnquiry" type="
com.tuningfork.student.businessobject.enquiry.StudentEnquiry"/>
       <form-property name="contactAddress" type="
com.tuningfork.student.businessobject.enquiry.StudentAddress"/>
</form-bean>

<action attribute="studentEnquiryForm" name="studentEnquiryForm"
path="/StudentEnquiryPre" scope="request"
           validate="false" type="
com.tuningfork.student.action.StudentEnquiryAction" parameter="operation">
      <forward name="preCreateSuccess" path="/student/StudentEnquiry.jsp"/>
        <forward name="preUpdateSuccess"
path="/student/StudentEnquiry.jsp"/>
        <forward name="viewSuccess" path="/student/StudentEnquiry.jsp"/>
    </action>

      <action attribute="studentEnquiryForm" name="studentEnquiryForm"
path="/StudentEnquiry" scope="request"
                 validate="true" type="
com.tuningfork.student.action.StudentEnquiryAction" parameter="operation"
input="/StudentEnquiryPre.do?operation=validateFailed">
          <forward name="preCreateSuccess"
path="/student/StudentEnquiry.jsp"/>
          <forward name="viewSuccess" path="/student/StudentEnquiry.jsp"/>
          <forward name="createSuccess"
path="/student/EntryConfirmation.jsp"/>
          <forward name="updateSuccess"
path="/student/EntryConfirmation.jsp"/>
          <forward name="createAndEnrollSuccess"
path="/StudentEnrollmentPre.do?operation=preCreate"
redirect="true"/>
      </action>

---------------------------------------

What I do see is that the validation.xml rules are working just fine. It is
just the validate function in the validatorform is not getting called.

What else do I need to do to make this work ?

Regards,
Raghu

Reply via email to