Hi all,
I searched the archives on this, but could not find an answer - hence I am
posting it here.
I have two date fields on my form. I want to validate that the first is
always on or before the second. I want the error message to show next to the
second date field.
In my Action-alias-validation.xml, I tried:
<validator type="expression">
<param name="expression">firstDate.after(secondDate)</param>
<message>First date cannot be after second date</message>
</validator>
This does not run during AJAX field validations.
I also tried:
<field name="secondDate">
<field-validator type="required">
<message>Second date cannot be empty</message>
</field-validator>
<field-validator type="date">
<param name="min">${firstDate}</param>
<message>Second date has to be on or later than first date
${firstDate}</message>
</field-validator>
</field>
This throws an error on the server-side:
WARNING: Caught OgnlException while setting property 'min' on type
'
com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator'
java.lang.NoSuchMethodException: setMin(
java.lang.String)
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:824)
at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:978)
at
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:75)
...
DateRangeFieldValidator expects the min parameter to be a date, and I think
the ${firstDate} construct did not work.
Can someone please guide how to accomplish this?
Thanks,
Binil
--
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)