• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 1.1 - validations - requiredif is not working

chingh tangh
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 property="name" depends="requiredif">
<arg0 key="label.name"/>
[ 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" />

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: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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic