struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <>
Subject Re: reset problem for a dynavalidator form
Date Sat, 02 Feb 2008 18:07:27 GMT
Ashima Beri wrote:
> Hi,
> I am trying to reset a validator form after the form is submitted and a few
> of the validations have failed.
> Reset button used in the form clears out fields changed only since the time
> the form is loaded. That is it does just the client side reset. One way that
> i figured out was to submit the form back to the jsp so that the jsp reloads
> with all the form field reinitialized.
> Is there some other method of clearing out the form fields after it has
> failed the validations defined in validation.xml?
> Thanks in advance for all the valuable suggestions!
> Ashima Beri

Do you want to clear out the form fields before redisplaying the form 
after a validation error, or just allow the user to request a reset 
after the form is redisplayed?

Usually you would want to retain the data the user input after a 
validation failure, so they can correct mistakes without having to fill 
the entire form in again. If you really want to reset the form to its 
starting state before redisplaying, discarding the user's input, then 
you would need to do that in your validate() method (remember, if you 
don't already have a validate() method, that when you add one it needs 
to call super.validate() to trigger the XML-based validation).

If you just want to provide a button the user can click to reset the 
form, a 'submit' button and round trip through your action is the 
correct way to do so. As you've realized, a 'reset' button just tells 
the browser to restore the input values it received the last time the 
form was loaded.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message