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

H

Hans Kesting

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.).
 
J

Josh

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top