option buttons submit

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a question on it. If the person answers the question
wrong, I want it to go to a page with the correct answer/explaination on it.
If the person answers correctly, I want it to go to a different page. How can
I do that on submit?

JoAnn
 
Hi Jo,

Something like this

<form>
what is the answer?
Right<input type="radio" value="RightAnswer" checked name="Answer">
Wrong<input type="radio" value="WrongAnswer" name="Answer">
<input type="button" value="Check Answer"
onclick="location.href=(this.form.Answer[0].checked)?'RightAnswerPage.htm':'WrongAnswerPage.htm';">
</form>

Cheers,
Jon
 
Ii tride the code you sent, and I must be doing something wrong. I'm
including my code. Would you be so kind as to look at it and see if you can
see my mistake?

Thanks,
JoAnn

<body>

<hr>
<h1 align="center">The Basics Test</h1>
<hr>
<h3 align="left">Question 1</h3>
<form>
<p><b>Which of the following would best define risk from an insurance point
of view?</b></p>
<p>
<input type="radio" value="WrongAnswer2" name="Answer">Financial
investments of a
speculative nature.<br>
<input type="radio" value="WrongAnswer3" name="Answer">Probability that a
loss will occur.<br>
<input type="radio" value="WrongAnswer4" name="Answer">Specific cause of an
individual loss.<br>
<input type="radio" value="RightAnswer" name="Answer">The chance of or
uncertainty
concerning a financial loss</p>
<p> </p>
<p><input type="submit" value="Check Answer"
onclick="location.href=(this.form.Answer[0].checked)?
'http://www.agentschoiceonline.com/5...stersBasicTest/Question1/Question1Correct.htm':
'http://www.agentschoiceonline.com/5...ustersBasicTest/Question1/Question1Wrong1.htm':
'http://www.agentschoiceonline.com/5...ustersBasicTest/Question1/Question1Wrong2.htm':
'http://www.agentschoiceonline.com/5...ersBasicTest/Question1/Question1Wrong3.htm':;">
</form>
<p> </p>
<p> </p>
<p> </p>

</body>
 
I even tried this set up, but it didn't work either:

<input type="button" value="Check Answer"
onclick="location.href=(this.form.Answer[0].checked)?'http://www.agentschoiceonline.com/5...tersBasicTest/Question1/Question1Wrong1.htm';">
onclick="location.href=(this.form.Answer[1].checked)?'http://www.agentschoiceonline.com/5...tersBasicTest/Question1/Question1Wrong1.htm';">
onclick="location.href=(this.form.Answer[2].checked)?'http://www.agentschoiceonline.com/5...tersBasicTest/Question1/Question1Wrong1.htm';">
onclick="location.href=(this.form.Answer[3].checked)?'http://www.agentschoiceonline.com/5...ersBasicTest/Question1/Question1Correct.htm';">
 
I took over this web site and have been afraid to change the filenames for
fear the links to them won't work. If I change the file name, does FP
automaticly fix everything?
 
Sorry Jo, I assumed there were just 2 answers - 1 right and 1 wrong. This
should do the trick for you
<body>
<script type="text/javascript">
function checkAnswer(f){
if(f.Answer[0].checked)location.href="....Replace With Url for Wrong Answer
2 ......";
else if(f.Answer[1].checked)location.href="....Replace With Url for Wrong
Answer 3 .";
else if(f.Answer[2].checked)location.href="...Replace With Url for Wrong
Answer 4 .....";
else if(f.Answer[3].checked)location.href="...Replace With Url for Correct
Answer......";
}
</script>
<hr>
<h1 align="center">The Basics Test</h1>
<hr>
<h3 align="left">Question 1</h3>
<form>
<p><b>Which of the following would best define risk from an insurance point
of view?</b></p>
<p>
<input type="radio" value="WrongAnswer2" name="Answer">Financial
investments of a
speculative nature.<br>
<input type="radio" value="WrongAnswer3" name="Answer">Probability that a
loss will occur.<br>
<input type="radio" value="WrongAnswer4" name="Answer">Specific cause of an
individual loss.<br>
<input type="radio" value="RightAnswer" name="Answer">The chance of or
uncertainty
concerning a financial loss</p>
<p> </p>
<p><input type="button" value="Check Answer"
onclick="checkAnswer(this.form);">

Cheers,
Jon
 
Thank you soooooooo much! It worked like a charm! Now, I only have about 50
more questions to write/answer!

Cheers Back To Ya!
JoAnn
 
Thanks for your help on that one, Steve. It is embarrassing to have file
names such as the ones that were previously named. I might eat my Wheaties
and try renaming them one at a time. This website was a mess when I took over
and because it is used by students, I figured I'd just leave well enough
alone. I'll back it up before I do any real changes, but first I have to work
on this project. Jon's help got the page to work for me, but I did take your
advise and just begin a new folder named correctly. The path is a lot shorter
too. Thanks!

JoAnn
 
This will require you to have 'n' functions for 'y' questions otherwise
they'll all have the same correct answer at the same location.


--
Mike - FrontPage MVP '97 - '02
Expression Tools & Addin
http://www.j-moves.com
http://www.panemanager.com
FrontPage Tools & Addin
http://www.jbots.com
E-Commerce
http://www.candypress.com



Jon Spivey said:
Sorry Jo, I assumed there were just 2 answers - 1 right and 1 wrong. This
should do the trick for you
<body>
<script type="text/javascript">
function checkAnswer(f){
if(f.Answer[0].checked)location.href="....Replace With Url for Wrong
Answer 2 ......";
else if(f.Answer[1].checked)location.href="....Replace With Url for Wrong
Answer 3 .";
else if(f.Answer[2].checked)location.href="...Replace With Url for Wrong
Answer 4 .....";
else if(f.Answer[3].checked)location.href="...Replace With Url for Correct
Answer......";
}
</script>
<hr>
<h1 align="center">The Basics Test</h1>
<hr>
<h3 align="left">Question 1</h3>
<form>
<p><b>Which of the following would best define risk from an insurance
point
of view?</b></p>
<p>
<input type="radio" value="WrongAnswer2" name="Answer">Financial
investments of a
speculative nature.<br>
<input type="radio" value="WrongAnswer3" name="Answer">Probability that a
loss will occur.<br>
<input type="radio" value="WrongAnswer4" name="Answer">Specific cause of
an
individual loss.<br>
<input type="radio" value="RightAnswer" name="Answer">The chance of or
uncertainty
concerning a financial loss</p>
<p> </p>
<p><input type="button" value="Check Answer"
onclick="checkAnswer(this.form);">

Cheers,
Jon

jkjmwilliams said:
Ii tride the code you sent, and I must be doing something wrong. I'm
including my code. Would you be so kind as to look at it and see if you
can
see my mistake?

Thanks,
JoAnn

<body>

<hr>
<h1 align="center">The Basics Test</h1>
<hr>
<h3 align="left">Question 1</h3>
<form>
<p><b>Which of the following would best define risk from an insurance
point
of view?</b></p>
<p>
<input type="radio" value="WrongAnswer2" name="Answer">Financial
investments of a
speculative nature.<br>
<input type="radio" value="WrongAnswer3" name="Answer">Probability that a
loss will occur.<br>
<input type="radio" value="WrongAnswer4" name="Answer">Specific cause of
an
individual loss.<br>
<input type="radio" value="RightAnswer" name="Answer">The chance of or
uncertainty
concerning a financial loss</p>
<p> </p>
<p><input type="submit" value="Check Answer"
onclick="location.href=(this.form.Answer[0].checked)?
'http://www.agentschoiceonline.com/5...stersBasicTest/Question1/Question1Correct.htm':
'http://www.agentschoiceonline.com/5...ustersBasicTest/Question1/Question1Wrong1.htm':
'http://www.agentschoiceonline.com/5...ustersBasicTest/Question1/Question1Wrong2.htm':
'http://www.agentschoiceonline.com/5...ersBasicTest/Question1/Question1Wrong3.htm':;">
</form>
<p> </p>
<p> </p>
<p> </p>

</body>
 
Back
Top