if i want to clear my form..it is not get cleared..'clear' button is not working...i had posted my jsp page...can you once check it..and provide me where i went wrong..
i tried what you had given in Way2...it is not working....i got why it is not working...i had doubt that i had text fields,combo boxes, check boxes and textarea in my form..for clear of form in javascript for clear..i need to mention all id's or just simple the form name is enough...i tried using form id for clear of my form fields...here is the code..
The default behavior of submit button is to submit the form data, and reset button is to reset the form data so implicitly it calls document.form.reset(). Now to change it's behavior you need to pass a false value to it. So as per the code, clearForm method returns a false value which is assigned to variable a, which is further passed to the reset method.
Swastik Dey wrote:The default behavior of submit button is to submit the form data, and reset button is to reset the form data so implicitly it calls document.form.reset(). Now to change it's behavior you need to pass a false value to it. So as per the code, clearForm method returns a false value which is assigned to variable a, which is further passed to the reset method.
But if you're not using the return value from the reset function there's no reason to assign it to a value--just return the results of the function execution. Otherwise it's just unnecessary clutter.