struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashima Beri <>
Subject Re: reset problem for a dynavalidator form
Date Sat, 02 Feb 2008 18:21:07 GMT

Hi Laurie,
Thanks for the quick reply.
I want to reset the form fields after hitting a reset button.
When I thought of going about it through the Action class way and tried to
clear out my form fields , strangely i noticed that the Action class's
execute method is never called if there are still certain validations
I read in struts flow explanation that Action class is only called if the
validations are passed through.
I dont know what other way to adopt.
Any suggestions?
Ashima Beri

Laurie Harper wrote:
> 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.
> L.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View this message in context:
Sent from the Struts - User mailing list archive at

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

View raw message