Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-11-2004, 11:09 PM   PM User | #1
MadDog88
New to the CF scene

 
Join Date: Nov 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
MadDog88 is an unknown quantity at this point
help with radio redirects

Hi all- I'm setting up a question form on my site. The form sends an email back to me. I have 2 radio buttons, and based upon which radio button the user selects, I want them to be taken to a different url. I don't have much experience with java- I think I've got the script in there but possibly in the wrong place. I'm still getting the data correctly but it's not redirecting the user to the right pages upon submission. Please help!

Here's the basic code for the page: http://www.dudecandles.com/questions3.htm

<html>
<head>
<title>Top</title>
<p>Questions

<form name="formname" method="post" action="http://formmail.dreamhost.com/cgi-bin/formmail.cgi" onSubmit="return FixIt();"
<p>
<input type=hidden name="recipient" value="info@dudecandles.com">
<input type=hidden name="question-text" value="Question">
<textarea name="question" cols="70" rows="6"></textarea>
</p>
<p>check one:</font> </p>
<p>
<input type="radio" name="person-type" value="badpeople" checked>
Bad People
<p>
<input type="radio" name="person-type" value="goodpeople">
Good People
<script language="javascript">
function FixIt() {
if (document.formname.person-type[0].checked==true) {
document.formname.redirect.value="http://www.dudecandles.com/thebird.htm";
} elsif (document.formname.person-type[1].checked==true) {
document.formname.redirect.value="http://www.dudecandles.com/thanks.htm";
}
}
</script>
<p>EMail Address (required):</font>
<input type=text name="email" size="45">
<input type=hidden name="env_report" value="REMOTE_HOST,HTTP_USER_AGENT">
<input type=hidden name="required" value="email, person-type">
<input type=hidden name="sort" value="alphabetic">
<input type=hidden name="print_blank_fields" value="1">
</p>
<p>
<input type=submit name="submit2">

</font> </p>
</form>

<body bgcolor="#FFFFFF" text="#000000">

</body>
</html>
MadDog88 is offline   Reply With Quote
Old 11-12-2004, 12:17 AM   PM User | #2
c1lonewolf
Regular Coder

 
Join Date: Sep 2002
Posts: 216
Thanks: 0
Thanked 11 Times in 11 Posts
c1lonewolf is an unknown quantity at this point
if you are just getting an error and this is the code from your page, fix this:


elsif (document.formname.person-type[1].checked==true) {
document.formname.redirect.value="http://www.dudecandles.com/thanks.htm";
}

else if - then it should work.
__________________
NO Limits!!
c1lonewolf is offline   Reply With Quote
Old 11-12-2004, 12:41 AM   PM User | #3
MadDog88
New to the CF scene

 
Join Date: Nov 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
MadDog88 is an unknown quantity at this point
Thanks for the help! I did fix that and it didn't work. It's actually taking me back to my hosting provider's default submission.

When I was just using a single page, this was the code I used and it worked fine. Do I need to do some variation of this?

<input type=hidden name="redirect" value="http://www.dudecandles.com/thanks.htm">
MadDog88 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:01 PM.


Advertisement
Log in to turn off these ads.