Solved

Radio buttons to select which ASP page to go to

Posted on 2002-05-08
7
179 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
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 create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …

920 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

13 Experts available now in Live!

Get 1:1 Help Now