I have dynavalidator form and I want to clear the fields on pressing clear. Below are the two options that i tried and it did not work.
The reason being(I think..).. I have a Insert screen and once submit is presssed I take them to a confirmation screen. If user presses cancel in the confirm screen, I bring them back to Insert screen(displays values previously entered). Now if user tries to press clear button ...clear does not clear the screen. why is this happening?
I did this in MresetAction class
dynaValidatorMForm.reset(mapping, request); it does not work.
My screen flow is INSERT screen--->ConfirmInsert screen (If cancel presed inside confirm screen)then back to INSERT Screen (if I press clear now it does nothing)
Are you talking about using the html:reset tag (same applies to the standard reset input tag)? If so then the functionality of that button is to reset all the fields back to the value they were when the page was displayed. Here is a thread with some info on the html:reset tag:
The reset method of DynaActionForm sets each field to the value specified in the "initial" attribute if you also specified reset="true" for that field. Otherwise, the reset method does nothing.
Another way to do it is is just to write code in your Action class that sets a default value (i.e. blanks or zeros) in each individual field. [ February 28, 2007: Message edited by: Merrill Higginson ]