Hello,
I am writing my first Struts application. I have a form that has a drop-down box, two text fields, a 'Continue' button, and a 'Clear' button. The user makes a selection from the drop-down, and then enters information in the two text fields. When they click the 'Continue' button, they are taken to an intermediate page where their selection and information is presented for confirmation. On that page their is a 'Submit' button and a 'Cancel' button. The 'Cancel' button is an <html:button> tag with an onclick attribute that is assigned 'window.location.href='firstPage'. If the user clicks on the 'Cancel' button, they are taken to the initial page where they made the selection and entered their information. The problem that I am encountering is that once they are on that page, if they decide to reset the field values and they click on the 'Clear' button, the fields do not clear. The 'Clear' button is an <html:reset> button. I have tried using the regual html <input type="reset" value="Clear" /> button, but I get the same results.
As long as the user does not click 'Continue' on the intial page, the 'Clear' button ( <html:reset> ) works; the problem comes if they go to the next page, realize they made a mistake and go back using the 'Cancel' <html:button value="Cancel" onklick="window.location.href='firstPage'"> (not using the back button).
As I was writing this post I remembered that I commented out the reset(ActionMapping mapping, HttpServletRequest request) function in the Action Form. The reason I did so was because the values were not being held from one page to the next, even though I specified a session scope in the struts-config.xml. So that may be why the 'Clear' button wouldn't work if I use the <html:reset> button, but I still don't understand why the 'Clear' button doesn't work if I use the regular html <input type="reset" value="Clear" />.
I hope this wasn't confusing. Any help would be greatly appreciated.
lugos
[ July 31, 2006: Message edited by: Samuel Lugo ]
[ July 31, 2006: Message edited by: Samuel Lugo ]