File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts 1.1 - validations - requiredif is not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 1.1 - validations - requiredif is not working" Watch "Struts 1.1 - validations - requiredif is not working" New topic
Author

Struts 1.1 - validations - requiredif is not working

chingh tangh
Greenhorn

Joined: Apr 06, 2004
Posts: 11
I am using struts 1.1, wrote the following for "requiredif" validation, but it doesn't work:
here is validations.xml
<field property="age" depends="required">
<arg0 key="label.age"/>
</field>
<field property="name" depends="requiredif">
<arg0 key="label.name"/>
<var>
<var-name>field[0]</var-name>
<var-value>age</var-value>
</var>
<var>
<var-name>fieldTest[0]</var-name>
<var-value>NOTNULL</var-value>
</var>
</field>
[ I have tried for NOTNULL and also NULL]
I have defined in the form beans as
===================================
<form-bean name="TestForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="age" type="java.lang.String" />
<form-property name="name" type="java.lang.String" />
<form-property name="testSubmit" type="java.lang.String" />
</form-bean>

My jsp is here:
==============
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:form action="someAction" onsubmit="return validateTestForm(this)" >
<html:text property="age" value="" />
<html:text property="name" value="" />
<html:submit property="testSubmit" value="TSubmit" />
</html:form>
<html:javascript formName="TestForm"/>
Here required validation for age is working, But name is not being validated for "requiredif".
I have seen the html page generated, it doesn't have the javascript code for name.
Only requiredif is not working...
what may be the problem...???
Pls clarify.
Thanks in advance.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 1.1 - validations - requiredif is not working
 
Similar Threads
DynaAction and validation
problem in DynaValidatorForm
Struts 1.1 validation help on Requiredif
Struts Validation of options box (java.lang.String[])
problem in DynaValidationForm