How to reset all the forms of an entire aspx page?

  • Thread starter Thread starter Jensen bredal
  • Start date Start date
Jensen said:
hmtl reset does not seem to work or i'm i doing something wrong?


MT

JB

The html reset button does not "clear" all inputs, but resets
then to the "original" values, that is: the values as defined
in the html sourcecode as received by the browser.
This doesn't work well in combination with postbacks: after
postback the html source containes the values as entered by
the user!

One generic server-side solution could be to loop through
all Controls on the page (recursive: you need to find
controls within controls) and "reset" them (TextBoxes to
String.Empty, clear checkboxes etc.).
 
hmtl reset does not seem to work or i'm i doing something wrong?

If you use javascript to access the document object model youll see that
there is a forms collection, you can iterate through that and call the reset
method on each one.
 
Back
Top