Hello Mailing,
Monday, June 21, 2004, 1:55:03 PM, you wrote:
ML> Dear All,
ML> I did the follow steps for setting validation, but there is no error on an
ML> empty field checking 'chequeNumber' (see below plz).
ML> 1. Placing the validation.xml & validator-rules.xml in WEB-INF folder
ML> 2. In struts-config.xml :
ML> a. <plug-in
ML> className="org.apache.struts.validator.ValidatorPlugIn">
ML> <set-property
ML> property="pathnames"
ML> value="/WEB-INF/struts/validator-rules.xml,
ML> /WEB-INF/struts/validation.xml" />
ML> </plug-in>
ML> b. <form-bean name="CreditStudentForm"
ML> type="org.apache.struts.validator.DynaValidatorForm">
ML> <form-property name="chequeNumber" type="java.lang.String"/>
ML> <form-property name="studentId" type="java.lang.Integer" />
ML> <form-property name="dispatch" type="java.lang.String" />
ML> </form-bean>
ML> c. <action path="/creditStudent" parameter="dispatch"
ML> type="com.pdpsoft.lms.struts.action.CreditStudentAction"
ML> name="CreditStudentForm" validate="false" scope="session"/>
Why validate="false"?
ML> 3. In validation.xml :
ML> <form name=" CreditStudentForm ">
ML> <field
ML> property=" chequeNumber "
ML> depends="required">
ML> </field>
ML> </form>
Try to add argument which point to field name (from resources):
<field property="passwordConfirm" depends="required">
<arg0 key="profile-form.confirm-password"/>
</field>
Also, I not sure what extra spaces at form name=" CreditStudentForm "
- is a good idea
ML> 4. In Action:
ML> ActionErrors errors = dynaForm.validate(mapping, request);
ML> if (!errors.isEmpty()) { //this if is never true :(
ML> saveErrors(request, errors);
ML> return mapping.findForward("aForward");
ML> }
ML> 5. In jsp:
ML> <html:errors/>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]