I have the following problem:
My validator gets NOT called as soon as I initialize some properties in
my form. In my form bean I have:
public class QueryTripsForm extends ValidatorActionForm
{
private String startPeriodDisplay = "2007-01-01";
private String endPeriodDisplay = "2099-12-31";
....
// other properties, getters and setters doing
// type conversions from string to date etc...
}
I did NOT implement (overwrite) the validate method, but I implemented
a reset method.
in my struts-config.xml I have:
....
<form-bean name="queryTripsForm"
type="ch.smartsol.struts.form.QueryTripsForm" />
...
<action
name="queryTripsForm"
path="/queryTrips"
scope="request"
input="/form/queryTrips.jsp"
validate="true"
type="ch.smartsol.struts.action.ListTripsAction">
<forward name="Success" path="/form/queryTrips.jsp" />
</action>
...
and in my validation.xml I have
<form name="/queryTrips">
<field property="startPeriodDisplay" depends="required, date">
<msg name="required" key="QueryTripsForm.start.required"/>
<msg name="date" key="QueryTripsForm.start.date"/>
<var>
<var-name>datePatternStrict</var-name>
<var-value>yyyy-MM-dd</var-value>
</var>
</field>
<field property="endPeriodDisplay" depends="required, date">
<msg name="required" key="QueryTripsForm.end.required"/>
<msg name="date" key="QueryTripsForm.end.date"/>
<var>
<var-name>datePatternStrict</var-name>
<var-value>yyyy-MM-dd</var-value>
</var>
</field>
</form>
If I do NOT initialize the two strings in my form bean the validator is
called and the first time the form displays it contains the validation
error messages!! If I initialize the two strings with a default value
(as shown above), the validator is NOT called at all and the user can
submit empty fields.
Any idea what I am doing wrong here???
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]