You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Laurie Harper <la...@holoweb.net> on 2006/06/04 22:13:50 UTC

Re: reset button deos not work with struts validator

Victor.T. Ying wrote:
> Hi,
> I meet a problem using structs validator and reset button
> The problem occurs when the validator find a validation error, then 
> reset button can not clear the input field but retain the error values.
> BTW the respective form is in the session and I am using html:reset tag.

I assume you meant that after a form is submitted and subsequently 
re-displayed due to validation errors, the reset button only puts the 
form inputs back to whatever the user entered in the form, and not to 
the values that were originally presented the first time the form was shown.

The HTML reset button will clear a form's values back to what they were 
when the page was delivered to the browser. There's no way for it to 
clear the values back to what they were when the previous request was 
served.

If you need to be to support that, you'll have to implement it 
server-side. You would probably want to use a cancel button 
(<html:cancel/>) instead of a reset button, to submit the form but 
bypass validation, and then restore the original form data in your 
action and redisplay the form again.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org