posted 20 years ago
The html:reset tag renders a <input type="reset"> tag. Reset does not necessarily clear the form field values. The behavior of this tag is to actually restore the values of form fields to what they had in the initial response. If your response came with non-blank field values, then those values will be restored when you click on the reset button. To see what I mean, try changing the value of a field when you get an error message. Then click on the "reset" button. The field you changed should be changed back to the "wrong" value, not cleared.
To get the behavior you want, you need a submit button, only you'd have the attribute value="Reset", i.e. you'd have something like
<html:submit property="action" value="Reset">
In your action class, you'd process the "Reset" request by clearing out the form field values. Note that you'd also have to skip over any validation code when the "Reset" request is submitted.
Another alternative is to use JavaScript to clear the form fields to avoid making a round-trip to the server just to clear fields (not sure if you can clear the error message thought) but I don't particularly like doing that. In practice, I just leave the error message up, let the user correct any errors and resubmit the form.