Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Radio buttons to select which ASP page to go to

Posted on 2002-05-08
7
Medium Priority
?
187 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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
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 300 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
Suggested Courses

810 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