Solved

Radio buttons to select which ASP page to go to

Posted on 2002-05-08
7
178 Views
Last Modified: 2010-04-07
Hi,
I have a HTM page that I have placed two radio buttons, a text box and a submit button onto.One of the radio buttons has a value of xxx the other a value of yyy.I want to set it up so that if I select radio button with yyy then press the submit button it goes to a certain asp page e.g. "1.asp" and passes the text I have put into the text box but if radio button xxx is selected when the submit button is pressed it goes to a different asp page e.g "2.asp" and still passes the text from the text box.

I can get it to submit the text info to one of the asp pages by putting the name of the page in the action field of the form post but cant see how to get it to change?
I am using dream weaver 4
ANy help or suggestions would be much appreciated
0
Comment
Question by:monitorwa
7 Comments
 
LVL 17

Expert Comment

by:dorward
ID: 6996686
Combine the functions of the two ASP pages in to a single page by wapping them in a big if statement.

I don't know ASP but this PHP example should give you an idea as to how to implement it:

if ($myRadio == 1) {
    do_this();
    do_that();
    do_the_other();
} else {
    do_somthing_else();
    do_another_thing();
    think_of_more_boring_function_names();
}
0
 
LVL 1

Expert Comment

by:raid999
ID: 6998669
you can try this it works for me:

<form action="choosepage.asp" method="post">
<input type="radio" name="PageChoice" Value="Page1"> Page 1<BR>
<input type="radio" name="PageChoice" value="Page2"> Page 2<BR>
name<input type="text" name="name">
<input type="submit" value="Choose Page">&nbsp;&nbsp;<input type="reset"></form>

ChoosePage.asp

<%
  Option Explicite
  Dim strChoice
  Dim strName

  strChoice= Request.Form("PageChoice")
  strName= Request.Form("name")

  if strChoice= "Page1" then
     Response.Redirect "page1.asp?name="+strName
  Else
     Response.Redirect "page2.asp?name="+strName
  End if
%>
0
 
LVL 1

Expert Comment

by:raid999
ID: 6998675
Sorry in the last part you should use & not + sorry again
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Expert Comment

by:raid999
ID: 6998686
Sorry in the last part you should use & not + sorry again
0
 
LVL 1

Accepted Solution

by:
zeheb earned 100 total points
ID: 7036676
This should also work.
I check it in my machine and it work.

<HTML>
<HEAD>
   <SCRIPT LANGUAGE=javascript>
         function SelectPage()
         {
             if (document.YourForm.Radio(0).checked)
                 document.YourForm.action = "1.asp"
             else    
                 if (document.YourForm.Radio(1).checked)
                     document.YourForm.action = "2.asp"
         }
   </SCRIPT>
</HEAD>
<BODY>
    <FORM NAME="YourForm" METHOD="GET" OnSubmit="JavaScript:SelectPage()">
        <INPUT NAME="Radio" TYPE="radio" VALUE="xxx"> <BR>
        <INPUT NAME="Radio" TYPE="radio" VALUE="yyy"> <BR>
        <INPUT NAME="TextBox" TYPE="text"> <BR>
        <INPUT TYPE="submit">
    </FORM>
</BODY>
</HTML>
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 8148400
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
   In the absence of responses, I may recommend DELETE unless it is clear
   to me that it has value as a PAQ.  Silence = you don't care
</note>

Cd&
0
 

Author Comment

by:monitorwa
ID: 8149011
Sorry guys - for some reason I hadnt been notified of any comments until just now? I actually figured it out a while ago but am happy to award the points as I have. As we all would have noticed what was Experts Exchange isnt anymore!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now