View Full Version : Unchecking checkboxes when refreshing
grant26
07-09-2003, 05:37 PM
Is there any way to make a browser uncheck checkboxes when you click the refresh or back button?
At the moment it remembers what a user checks, but i dont want this as it completely messes up my javascript functions that enable and disable form objects.
i.e. initially textboxes etc are disabled, when the user clicks on a checkbox it enables it, however if a user clicks the refresh button the textfields etc go back to being disabled, but the checkbox remains checked, which turns everything on its head!
Roy Sinclair
07-09-2003, 06:26 PM
You can use the "onload" event to issue a reset to the form.
onload="document.forms["nameofyourform"].reset();"
grant26
07-10-2003, 10:50 AM
Hi, thanks for the reply, im new to this and im not too sure about where the onload event should go.
I have tried it in:
<body background="H:/Web/MScWebSite/pound.gif" onload="document.forms[substructure].reset();">
I have also tried it in the javascript area of my code and simply by itself in the body...none of these work.
Also, should the semi colon not be after the quotation marks? Secondly do you include the quotation marks around the name of my form?
Roy Sinclair
07-10-2003, 03:14 PM
Also, should the semi colon not be after the quotation marks?
No, the semi-colon is a line terminator character for JS so it's a part of the script which means it should be inside the quote marks.
Secondly do you include the quotation marks around the name of my form?
Yes, use the single quote mark to make it easier:
<body background="H:/Web/MScWebSite/pound.gif" onload="document.forms['substructure'].reset();">
Uh, is this page only run from your hard disk? If not, your background reference (highlighted in green) needs to be fixed because it should be a URL or it'll only work from your computer.
grant26
07-10-2003, 04:13 PM
Uh, is this page only run from your hard disk? If not, your background reference (highlighted in green) needs to be fixed because it should be a URL or it'll only work from your computer.
Yes, you are right, ill have to change that.
Otherwise the form has reset itself how i wanted it to, thanks very much!
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.