Ok, I think I have the solution to my own problem. Since reviewdate
is a date field, I was using the s:date tag in my jsp, like this:
<s:date name="moviereview.reviewdate" format="%
{getText('struts.date.format')}" id="reviewdateFormatted"/>
<s:textfield value="%{reviewdateFormatted}"
name="moviereview.reviewdate" size="12" maxlength="10"/
I gather that reviewdate can't be set properly when I use the date tag
like this since what's being repopulated most likely won't be a valid
date.
To get around this, I just added a test for the presence of
fielderrors before using the s:date tag. If none are there, then use
the date tag. If it is there, then just display the reviewdate field
directly.
Kevin
On Apr 2, 2008, at Wednesday, April 2, 2008 - 5:02 PM, Kevin Wade
wrote:
Hello. I am having a problem getting "repopulateField" to work. In
short, I have added date validation to one of my actions. In my
validation xml file, I have this:
<field name="moviereview.reviewdate">
<field-validator type="conversion" short-circuit="true">
<param name="repopulateField">true</param>
<message>Date of Review entered is not a valid date.</message>
</field-validator>
<field-validator type="date">
<param name="min">01/01/2007</param>
<param name="max">12/31/2008</param>
<message>Date of Review is out of range. </message>
</field-validator>
</field>
My problem is that "repopulateField" is not actually repopulating
the moviereview.reviewdate field on a conversion error. The field
is blank.
In my action, I have a "moviereview" object that has a getter and
setter (i.e. "setMoviereview() and getMoviereview()"). So,
"reviewdate" is a Date that belongs to that parent object. I don't
know if that's related at all, though.
Any idea why this isn't working?
Kevin