How to make reset button clear all fields
I noticed the following behavior for RESET button in STRUTS framework: The Reset button will clear all fields on the first try. After that, if you encountered validation errors, it seems to remember what have been so far. From that point on, the reset button only clears the new input values. Case in point -- try the struts-example login.jsp and you know what I am talking about. What should I do if I still want to clear all field contents. I tried to use another button declared as input type=reset and it is not working either. Shu, Kwang-shi | Tel 732-460-7848 Village Networks, Inc. | Fax 732-460-9851 246 Industrial Way West | Eatontown, NJ 078724| email: [EMAIL PROTECTED]
RE: How to make reset button clear all fields
One alternative is to write a JavaScript function that will clear all your text fields. Bind the function to the onClick event of a generic HTML button tag and you're set. Note that this only affects what you see on the screen, it's never touching the server. If you were to hit your new reset JavaScript-based button it'd look cleared; however, if you hit refresh your values would be re-populated. :) Regardless, this suggestion will simulate an HTML reset button. Chris Christopher Assenza Phone: 412.201.6026 Fax: 412.201.6060 Email: [EMAIL PROTECTED] ACCESSDATA Moving Your Business from Point A to Point e.SM http://www.accessdc.com/ -Original Message- From: Kwang-Shi Shu [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 30, 2001 12:33 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: How to make reset button clear all fields I noticed the following behavior for RESET button in STRUTS framework: The Reset button will clear all fields on the first try. After that, if you encountered validation errors, it seems to remember what have been so far. From that point on, the reset button only clears the new input values. Case in point -- try the struts-example login.jsp and you know what I am talking about. What should I do if I still want to clear all field contents. I tried to use another button declared as input type=reset and it is not working either. Shu, Kwang-shi | Tel 732-460-7848 Village Networks, Inc. | Fax 732-460-9851 246 Industrial Way West | Eatontown, NJ 078724| email: [EMAIL PROTECTED]
RE: How to make reset button clear all fields
The Reset button is working the way the HTML specification has it defined just as you described. It only resets the fields that have changed since the page was displayed. In order to work around this problem, I created a ResetAction class that gets called when you click on the reset button. This class either disposes of the FormBean or clears the attributes and posts back to the form page. Hope this helps. Kevin Hinners Senior Technical Analyst FedEx Services 350 Spectrum Loop Colorado Springs, CO 80921 719-484-2303 [EMAIL PROTECTED] -Original Message- From: Kwang-Shi Shu [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 30, 2001 10:33 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: How to make reset button clear all fields I noticed the following behavior for RESET button in STRUTS framework: The Reset button will clear all fields on the first try. After that, if you encountered validation errors, it seems to remember what have been so far. From that point on, the reset button only clears the new input values. Case in point -- try the struts-example login.jsp and you know what I am talking about. What should I do if I still want to clear all field contents. I tried to use another button declared as input type=reset and it is not working either. Shu, Kwang-shi | Tel 732-460-7848 Village Networks, Inc. | Fax 732-460-9851 246 Industrial Way West | Eatontown, NJ 078724| email: [EMAIL PROTECTED]
Re: How to make reset button clear all fields
You can try another button (input type button) associated with a method in your bean. This method will reset your atributes in your bean i.e. this.XXX=; (String case) this.YYY=0; (int case) ... - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, August 30, 2001 01:33 PM Subject: How to make reset button clear all fields I noticed the following behavior for RESET button in STRUTS framework: The Reset button will clear all fields on the first try. After that, if you encountered validation errors, it seems to remember what have been so far. From that point on, the reset button only clears the new input values. Case in point -- try the struts-example login.jsp and you know what I am talking about. What should I do if I still want to clear all field contents. I tried to use another button declared as input type=reset and it is not working either. Shu, Kwang-shi | Tel 732-460-7848 Village Networks, Inc. | Fax 732-460-9851 246 Industrial Way West | Eatontown, NJ 078724| email: [EMAIL PROTECTED]