Hi Folks
following on from Ricardo's post - 'how to validate boolean field...' but that
thread seems to have gone cold (my addition hasn't flagged up in the latest posts list) so I'll try again here - appologies if this is missuse
I'm trying to validate the same checkbox scenario but am obviously still doing something wrong. I had made the same mistake using html input tags instead of
struts html:checkbox tags. However rectifying this hasn't made any difference at all. Below are the relevant bits out of my code, if someone can tell me where I'm going wrong it'd be much appreciated. Thanks in advance, Hamish.
(NB further validation of text fields in the same multi page form do work)
from
jsp...
<html:hidden property="page" value="1"/>
<td colspan="5" class="bodyHeader"><bean:message key="checkout.custDetails.lable.acceptTerms"/><div class="bodyError"><html:errors property="acceptTerms"/></div></td>
<td></td>
<td colspan="3" align="right"><img src="<%=request.getContextPath()%>/images/rightArrow.gif" border="0"/> <bean:message key="cart.link.terms"/></td>
<td></td>
<td><html:checkbox property="acceptTerms"/></td>
from validate.xml...
<form name="orderForm">
<field
property="acceptTerms"
page="1"
depends="required">
<arg0 key="checkout.error.acceptTerms"/>
</field>
reset method in action form (which extends ValidatorForm)...
public void reset(){
this.setAcceptTerms(false);
}