Here is what I have in my struts-config <form-bean name="siteForm" type="org.apache.struts.validator.DynaValidatorForm" >
<form-property name="site" type="com.tryit.service.datatransfer.SiteDTO"/>
<form-property name="sitePrefs" type="com.tryit.service.datatransfer.SitePrefsDTO"/>
<form-property name="siteConfiguration" type="com.tryit.service.datatransfer.SiteDTO"/>
</form-bean>
The way the JSP is laid out is each property is a tab on the html. I can validate the first one using following validation. <form name="siteForm">
<field property="site.name" depends="required">
<arg0 key="label.name"/>
</field>
<field property="site.webUrl" depends="required">
<arg0 key="label.homeUrl"/>
</field>
<field property="site.loginUrl" depends="required">
<arg0 key="label.loginUrl"/>
</field>
<field property="site.description" depends="required">
<arg0 key="label.description"/>
</field>
<field property="site.callinNumber" depends="optionalMask">
<arg0 key="label.callInNumber"/>
<var>
<var-name>mask</var-name>
<var-value>${phone}</var-value>
</var>
</field>
<field property="site.minIntendedAge" depends="optionalMask">
<arg0 key="label.minIntendedAgeMsg"/>
<var>
<var-name>mask</var-name>
<var-value>${numeric}</var-value>
</var>
</field>
<field property="site.callinCode" depends="optionalMask">
<arg0 key="label.callInCode"/>
<var>
<var-name>mask</var-name>
<var-value>${numeric}</var-value>
</var>
</field>
<field property="site.maxIntendedAge" depends="optionalMask">
<arg0 key="label.maxIntendedAgeMsg"/>
<var>
<var-name>mask</var-name>
<var-value>${numeric}</var-value>
</var>
</field>
</form>
and here is my ActionMap <action path="/updateSite"
type="com.tryit.ui.action.SiteAdminManagement"
parameter="method"
roles="authenticatedUser"
validate="true"
name="siteForm"
input=".siteInfo">
<forward name="adminHome" path=".siteManagementHome"/>
<forward name="manageSite" path=".siteInfo"/>
<forward name="manageSiteConfiguration" path=".siteConfiguration"/>
</action>
and finally an excerpt of the JSP that contains the Configuration tab.
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<html:img srcKey="images.space" width="1" height="13"/><br/>
<table width="575" border="3" cellspacing="0" cellpadding="5" bordercolor="#C1CDE1"
class="innertable">
<tr>
<td align="left" valign="top">
<%--Overview Section--%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<html:form action="<%=IConstants.UPDATE_SITE_CONFIGURATION%>" focusIndex="1">
<bean
efine id="siteConfiguration" name="siteForm" property="siteConfiguration" property="siteConfiguration"/>
<tr>
<td class="subhead">
<hr noshade color="#C1CDE1">
</td>
</tr>
<tr>
<td class="normal">
<table>
<tr>
<td align="right" class="formlabel"> <bean:message key="label.prospectPurgeDays"/>
<html:img srcKey="images.space" width="5"/></td>
<td> <html:text property="siteConfiguration.prospectPurgeDays" /> </td>
</tr>
<tr>
<td colspan="2" class="errorlabel">
<html:messages id="error" property="siteConfiguration.prospectPurgeDays" >
<bean:write name="error"/>
</html:messages>
prospectPurgeDays is one of the fields on siteConfiguration data object. I have tried everything in the validation like the folowing but nothing works.
<form name="siteConfiguration">
<field property="siteConfiguration.prospectPurgeDays" depends="required">
<arg0 key="label.propectPurgeDays"/>
<var>
<var-name>mask</var-name>
<var-value>${numeric}</var-value>
</var>
</field>
</form>
tried it with site.siteConfiguration.propectPurgeDays, propectPurgeDays, siteForm.siteConfiguration.prospectPurgeDays etc.... I changed these in the JSP also along with any combination. Two weeks 3 books and I cannot get it. I just can't get the validator to validate the siteConfiguration but it works on the site tab only.
Any help???