Reset webform without using HTML reset button???
On my webform I am currently using the HTML Reset button to reset the form. The problem is that when the form is viewed by someone to approve I would like to hide the button along with some other options to be available only on data entry.
Is there another way i can reset the form, possibly in vbscript.
I tried doing it in javascript but the validateRequiredFields that I have on the form fires stopping the reset.
Anyone have any ideas?
Thanks.
Re: Reset webform without using HTML reset button???
Where are you firing the JavaScript from? Can you turn of the CauseValidation for that Control?
Re: Reset webform without using HTML reset button???
Use an asp:button whose causesvalidation property is false. In its codebehind, run through the control, setting textboxes to blank, comboboxes to first element, and so on.
Re: Reset webform without using HTML reset button???
The javascript was in the onclick event for the asp button.
I didn't even notice the CauseValidation property for the button, I will try it now with that set to false and I am sure it should work now.
Thanks again guys.
Magiaus, you always get my posts, thanks again. You should have my job.
Re: Reset webform without using HTML reset button???
To me reseting the form means making it contain the initial values it had when it was served to the client. Therefore - simply blanking out text boxes and selecting the first index of a combobox is not a reset - its a clear.
Now, I don't know what your true intention was (reset or clear), but if it was the former then all you really need to suceed at it is:
document.forms[0].reset();
which resets all form values to their initial values as they were when the form was delivered to the client.