Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clearing the Radio Button once submitted 1

Status
Not open for further replies.

cvasquez

MIS
Joined
Feb 28, 2001
Messages
88
Location
US
I am having a hard time clearing a Radio button once a user hits the submit button. On the result page the user hits the back button on the browser and the previously selected radio button is still checked. I don't want this radio button to be checked. Here is a quick sample of a similar logic creating the problem.

HTML page 1 (1st Page):
=======================
<HTML>
<HEAD>
<TITLE> Choose Report Name </title>
</head>
<BODY>
<form name=&quot;cool&quot; method=&quot;post&quot; action=&quot;test2.html&quot;>
<input type='radio' name='report' value='1' selected>Report 1<br><br>
<input type='radio' name='report' value='2' >Report 2<br><br>
<input type='radio' name='report' value='3' >Report 3</td><BR><BR>
<INPUT type=&quot;submit&quot;>
</form>
</body>
</html>

HTML page 2 (Result Page):
==========================
<HTML>
<HEAD>
<TITLE> RECEIVE OK</title>
</head>

<BODY>
This is the result page.
</body>
</html>

Try hitting the back button on your browser on the result page. As you can see the radio button is still check. (using Internet Explorer 6. I hope that there is someone out there that can help me clear this problem.

Any help would be mostly appreciated.

Sincerely;

Carlo
 
radioArr = document.cool.report

for (x=0; x<radioArr.length; x++){
radioArr[x].checked = false
}

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
of course, if you put code like this in you onSubmit function, the next page will not know the value of the radio button. You would have to store the value in a hidden field or something...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
This might just help.
Thanks a mill.
 
I had a problem similar to that and because the user already submitted the information I just didn't let him go back to the previous page once they got the confirmation page.


on the page that holds your form add at the top
<script>
window.history.forward(1);
</script>

That will force the page to go the confirmation page every time the user hits the back button therefore not allowing them to go back to the form.



grtfercho çB^]\..
 
Why not reset the form when loaded?

<body onload=&quot;document.formName.reset()&quot;>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top