MildewMan1 Posted April 27, 2007 Share Posted April 27, 2007 I was wondering if there was a way to empty all check boxes that have been selected if the user refreshes the page. As of now, you can select some, refresh and they will still be checked.Edit:I got it to refresh in IE, but firefox still keeps checked values Link to comment Share on other sites More sharing options...
Mr_CHISOL Posted April 28, 2007 Share Posted April 28, 2007 You could use JavaScript that resets the form on load, think you would do something like this document.getElementById('myForm').reset(); Link to comment Share on other sites More sharing options...
The Praetorian Posted April 28, 2007 Share Posted April 28, 2007 Not sure if you want them to have to refresh the page, or just so it isn't selected if they navigate there... but you could always use the built in form clear. <input type="reset" /> Link to comment Share on other sites More sharing options...
Anders Moen Posted April 28, 2007 Share Posted April 28, 2007 <input type="reset" /> The form will only be reset if a person clicks on the reset button there. Try the JavaScript Mr_CHISOL gave you Link to comment Share on other sites More sharing options...
thibo1025 Posted April 28, 2007 Share Posted April 28, 2007 you could always do like this: <html><head><title>myPage</title><script language="JavaScript" type="text/javascript">function resetform(){document.getElementById('myForm').reset();}</script></head><body onload="resetform()"><form id="myForm"> ....</form></body></html> This way, when the body will reload, the form will reset Link to comment Share on other sites More sharing options...
MildewMan1 Posted April 28, 2007 Author Share Posted April 28, 2007 I'll try this out and let you know if it works. Thanks for the responses.Edit: Nothing I have tried will work with FireFox =/ Link to comment Share on other sites More sharing options...
MildewMan1 Posted May 2, 2007 Author Share Posted May 2, 2007 you could always do like this:<html><head><title>myPage</title><script language="JavaScript" type="text/javascript">function resetform(){document.getElementById('myForm').reset();}</script></head><body onload="resetform()"><form id="myForm"> ....</form></body></html> This way, when the body will reload, the form will reset Just wanted to thank you for this code. Had to tweak it a bit, but finally got it to work. Changed the "getElementById('myForm')" part just to the name of my form and it worked perfectly. This is what I used:<script language="JavaScript" type="text/javascript">function UncheckAll(){document.NameOfMyForm.reset();}</script> and then <body onload="UncheckAll();"> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.