PDA

View Full Version : redirect


kathryn
02-04-2003, 01:21 PM
Hi,
I need a piece of javascrict that if a user selects I disagree on a radio button then a new window appears.
I am using the following javascript checks but am just missing the line that fires up the new window??
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function submitIt(AppForm1{
var digits="0123456789"
var temp

TermsLegals = -1
for (i=0; i<AppForm1.TermsLegals.length; i++) {
if (AppForm1.TermsLegals[i].checked){
TermsLegals = i
}
}
if (TermsLegals == 2){
***** code for new window here*****
AppForm1.TermsLegals[0].focus();
return false
}

return true
}
// End -->
</SCRIPT>

Thanks, Kathryn

arnyinc
02-04-2003, 01:34 PM
Is there just one choice between "I agree" and "I disagree" or does the user have multiple choices to disagree?

kathryn
02-04-2003, 01:44 PM
There are 4 questions each with a disagree option if the user selects I disagree to any one of them then a new window appears.

arnyinc
02-04-2003, 01:57 PM
This is how I would do it. There might be a cleaner way. This checks to make sure they checked the agree box, so if they leave it blank or check disagree, it pops up the window with the disagree.htm file in it.


<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function submitIt(AppForm1){

if((!AppForm1.TermsLegal1[0].checked)||(!AppForm1.TermsLegal2[0].checked)||(!AppForm1.TermsLegal3[0].checked)||(!AppForm1.TermsLegal4[0].checked)){
window.open("disagree.htm");
return false;
}
else
return true;
}
// End -->
</SCRIPT>
</head>

<body>
<form name="myform" onsubmit="return submitIt(this);">
<input type="radio" name="TermsLegal1" value="agree">a<input type="radio" name="TermsLegal1" value="disagree">d<br>
<input type="radio" name="TermsLegal2" value="agree">a<input type="radio" name="TermsLegal2" value="disagree">d<br>
<input type="radio" name="TermsLegal3" value="agree">a<input type="radio" name="TermsLegal3" value="disagree">d<br>
<input type="radio" name="TermsLegal4" value="agree">a<input type="radio" name="TermsLegal4" value="disagree">d<br>
<input type="submit">
</form>
</body>
</html>

kathryn
02-04-2003, 02:19 PM
Thanks that worked great, Kathryn