HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
help with radio button target
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form
View previous topic :: View next topic  
Author Message
mathangi



Joined: 17 Sep 2004
Posts: 3

PostPosted: Fri Sep 17, 2004 5:33 am     help with radio button target Reply with quote

Hello all,
I have a form with 2 radio buttons (select radio button 1 or 2) and a "Su
bmit" button.
If the user selects radio button 1, and clicks the "Submit" button, it w
ill go to page A.
If the user selects radio button 2, and clicks the "Submit" button, it w
ill go to page B.

Could somebody help me in doing this.

I am a novice to using forms, therefore your help is greatly appreciated.


Regards,
Mathangi
mjpliv



Joined: 11 May 2004
Posts: 406
Location: Nova Scotia

PostPosted: Mon Sep 20, 2004 7:15 am     Reply with quote

Where does the "submit" button sent the information? Corey may have a javascript answer to this question.
mathangi



Joined: 17 Sep 2004
Posts: 3

PostPosted: Mon Sep 20, 2004 9:49 am     radio buttons Reply with quote

Hello,

Let me ask the question this way!!!

There is only one "submit" which I want to use for selecting either of the radio buttons. But upon selection of the radio buttons, each selection should go to a different web page.

I have a primitive way of doing it.
For ex: Write 2 forms, where action="respective url page" for each submit button.

Could somebody please help me.


Thanks
mathangi
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8316
Location: Castle Pines North, CO USA

PostPosted: Mon Sep 20, 2004 1:33 pm     Reply with quote



And what makes you think that? LOL

Well if I understand your question, you might try:
Code:
<form name="myForm" action="firstpage.php" method="get">
<input type="radio" name="r" value="firstpage.php" selected="selected" onclick="this.form.action=this.value;"> First Page<br>
<input type="radio" name="r" value="secondpage.php" onclick="this.form.action=this.value;"> Second Page<br>
<input type="submit" value="Submit">
</form>

or
Code:
<form>
<input type="hidden" name="gotolink" value="#" />
<input type="radio" onClick="this.form.gotolink.value=this.value;" value="page1.html" />P1
<input type="radio" onClick="this.form.gotolink.value=this.value;" value="page2.html" />P2
<input type="button" value="Go!" onclick="document.location=this.form.gotolink.value;" />
<form>
mathangi



Joined: 17 Sep 2004
Posts: 3

PostPosted: Tue Sep 21, 2004 5:21 am     radio button Reply with quote

Hello Corey Bryant

Thanks for your help. This is exactly what I wanted!!!!

Regards
Mathangi Very Happy
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8316
Location: Castle Pines North, CO USA

PostPosted: Tue Sep 21, 2004 5:26 am     Reply with quote

Flad that I could be of help. Good luck with it! Smile
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial