scripter73
Programmer
Hi,
I know this is a textbook question, but I'm still having problems with it.
Goal. I have 4 radio buttons. I want my script to function so that when the user clicks on Button 1 and clicks Redirect button, they're redirected to Form4.html, Button 2(=Form6.html); Button 3(=Form7.html); Button 4(=complete.html).
Ideally, I would like the page to redirect automatically as soon as the user clicks the button, but my user doesn't want that. They want to make the selection and click a 'Continue-like' button.
Here's the problem. No matter what the user selects, it always goes to the first button entry. When you click the button to continue processing, you notice the first button gets checked again.
If you'd like to take a look at the functionality, I have it out on
For debugging purposes, I have 2 buttons called Show Checked and Redirect. If you make a selection, and click Show Checked, it will show you the actual value. If you click Redirect, it should attempt to redirect you. It does, but to the same 1st page.
Hope this is clear. Any help is appreciated.
Oh, here's the code (I have a little JS mixed in too):
<html>
<head>
<title>Claims - Form 3</title>
<script language="Javascript">
function process_redirect(){
if (document.form3.addinfo[0].checked = true)
window.location.href="form4.html";
else if (document.form3.addinfo[1].checked = true)
window.location.href="form6.html";
else if (document.form3.addinfo[2].checked = true)
window.location.href="form7.html";
else if (document.form3.addinfo[3].checked = true)
window.location.href="complete.html";
return;
}
function show_checked(){
if (document.form3.addinfo[0].checked = true)
document.write(document.form3.addinfo[0].value);
else if (document.form3.addinfo[1].checked = true)
document.write(document.form3.addinfo[1].value);
else if (document.form3.addinfo[2].checked = true)
document.write(document.form3.addinfo[2].value);
else if (document.form3.addinfo[3].checked = true)
document.write(document.form3.addinfo[3].value);
}
</script>
</head>
<body>
<form action="" name="form3" method="post">
<font face="Verdana, Arial, Sans-Serif" size=1 color="#083194">
<table cellpadding=0 cellspacing=0 width=600 border=0>
<tr>
<td width=600 colspan=2>
<font face="Verdana, Arial, Sans-Serif" size=3 color="#083194">
</font>
</td>
</tr>
<tr>
<td width=600 colspan=2><hr></td>
</tr>
</table>
<font size=2>
<input type="radio" name="addinfo" value="another_vehicle">
Check here to add information about <font color="red">Another Vehicle</font> that was involved.<br><br>
<input type="radio" name="addinfo" value="property">Check here to add information about
<font color="red">Property</font> that was damaged.<br><br>
<input type="radio" name="addinfo" value="pedestrian">Check here to add information about a
<font color="red">Pedestrian</font> that was injured.<br><br>
<input type="radio" name="addinfo" value="completed_report">Check here if your report
is <font color="red">Complete</font>.<br><br>
<input type="button" value="Show Checked" name="Form3_Show Checked" onclick="show_checked()";>
<input type="button" value="Redirect" name="Form3_Redirect" onclick="process_redirect()";>
<input type="reset" value="Reset" name="Form3_Reset">
</font>
</form>
</body>
</html>
Thanks,
scripter73
I know this is a textbook question, but I'm still having problems with it.
Goal. I have 4 radio buttons. I want my script to function so that when the user clicks on Button 1 and clicks Redirect button, they're redirected to Form4.html, Button 2(=Form6.html); Button 3(=Form7.html); Button 4(=complete.html).
Ideally, I would like the page to redirect automatically as soon as the user clicks the button, but my user doesn't want that. They want to make the selection and click a 'Continue-like' button.
Here's the problem. No matter what the user selects, it always goes to the first button entry. When you click the button to continue processing, you notice the first button gets checked again.
If you'd like to take a look at the functionality, I have it out on
For debugging purposes, I have 2 buttons called Show Checked and Redirect. If you make a selection, and click Show Checked, it will show you the actual value. If you click Redirect, it should attempt to redirect you. It does, but to the same 1st page.
Hope this is clear. Any help is appreciated.
Oh, here's the code (I have a little JS mixed in too):
<html>
<head>
<title>Claims - Form 3</title>
<script language="Javascript">
function process_redirect(){
if (document.form3.addinfo[0].checked = true)
window.location.href="form4.html";
else if (document.form3.addinfo[1].checked = true)
window.location.href="form6.html";
else if (document.form3.addinfo[2].checked = true)
window.location.href="form7.html";
else if (document.form3.addinfo[3].checked = true)
window.location.href="complete.html";
return;
}
function show_checked(){
if (document.form3.addinfo[0].checked = true)
document.write(document.form3.addinfo[0].value);
else if (document.form3.addinfo[1].checked = true)
document.write(document.form3.addinfo[1].value);
else if (document.form3.addinfo[2].checked = true)
document.write(document.form3.addinfo[2].value);
else if (document.form3.addinfo[3].checked = true)
document.write(document.form3.addinfo[3].value);
}
</script>
</head>
<body>
<form action="" name="form3" method="post">
<font face="Verdana, Arial, Sans-Serif" size=1 color="#083194">
<table cellpadding=0 cellspacing=0 width=600 border=0>
<tr>
<td width=600 colspan=2>
<font face="Verdana, Arial, Sans-Serif" size=3 color="#083194">
</font>
</td>
</tr>
<tr>
<td width=600 colspan=2><hr></td>
</tr>
</table>
<font size=2>
<input type="radio" name="addinfo" value="another_vehicle">
Check here to add information about <font color="red">Another Vehicle</font> that was involved.<br><br>
<input type="radio" name="addinfo" value="property">Check here to add information about
<font color="red">Property</font> that was damaged.<br><br>
<input type="radio" name="addinfo" value="pedestrian">Check here to add information about a
<font color="red">Pedestrian</font> that was injured.<br><br>
<input type="radio" name="addinfo" value="completed_report">Check here if your report
is <font color="red">Complete</font>.<br><br>
<input type="button" value="Show Checked" name="Form3_Show Checked" onclick="show_checked()";>
<input type="button" value="Redirect" name="Form3_Redirect" onclick="process_redirect()";>
<input type="reset" value="Reset" name="Form3_Reset">
</font>
</form>
</body>
</html>
Thanks,
scripter73