Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using 2 diff response page to load based on form object selection

Posted on 2002-07-03
7
Medium Priority
?
232 Views
Last Modified: 2010-03-05
Currently my perl script goes to one response/return page after the user submits the form data input. The path to the page is coded as $html_path="/usr/local/myserverhtml/response.html

Within the form's html form object are two radio buttons
 <input type="radio" value="yes" name="helpneeded">
 <input type="radio" value="no" name="helpneeded">

What I'm trying to accomplish is to have the user get a return page that corresponds with whichever of the radio button he selected on the form, e.g., if user selects "NO" for "helpneeded" then he gets to the helpneeded.html page after he submits the form results.

I tried embedding a javascript and used the return/response html pages as values but that would be incorrect, since I want the values to be retained as either "YES|NO"

Can anyone help me with this please?
Thanks.
-jamaica-
           
0
Comment
Question by:jamaica
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 12

Expert Comment

by:lexxwern
ID: 7127267
does the form get submitted by POST or GET ?
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7127276
<offtopic>
and have i helped you in the other Q?
</offtopic>
0
 

Expert Comment

by:lakshmisubram
ID: 7127332
after choosing the radio button do you want to throw different html pages based on the chosen radio buttons ?
can you explain in detail more?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Expert Comment

by:lakshmisubram
ID: 7127361
Depending on form object selection , you want to load different pages . right ? This is the thing you need to do ?

<html>
<head>
<script language="JavaScript">
function submitForm()
{
   if (document.test.helpneeded[0].checked)
   {
     window.location ="http://www.experts-exchange.com";
   }
   else if (document.test.helpneeded[1].checked)
   {
     window.location ="http://www.yahoo.com";
   }
}
</script>
</head>
   
<form name="test">
<input type="radio" name="helpneeded" value="yes" onClick="submitForm();">yes
<input type="radio" name="helpneeded" value="no" onClick="submitForm();">no
</form>
</html>
0
 

Author Comment

by:jamaica
ID: 7127457
lexxwern, the form uses POST and yes you have helped me with one QID :)

lakshmisubram, the html page is loaded *when* the user selects the "submit" button but the html page loaded must relate to the radiobutton selection. Therefore onClick wouldn't work.

I'd tried it using the script below in perl but what I get is the actual radiobutton <input value="whatevervalueishere">

<input type="radio" name="response" value="yes_response.html" onclick="document.forms[0].action = this.value" />  YES
<br />
<input type="radio" name="response" value="no_response.html" onclick="document.forms[0].action = this.value" />  NO

I ran into 2 probs with this method above.
#1. The POST method does not work with this ... it didn't work and then when I hit back and resubmitted the form, it worked BUT the value posted in the received email showed as the html page link (i.e., "no_response.html") AND the POST used the $html_path="response.html"

The main focus are ...

a. to get radio button selection to correspond to an html page, whereas, the user selects the SUBMIT button and if the form detected that "NO" was selected then he's sent to "no_response.html"

b. Have the POST read the $html_path for either "no_response.html" or "yes_response.html" based on the radiobutton selection.

If I can't accomplish this then I'll have to figure out how to parse data field entries from form1 to form2 and have form2 POST the form data and send the user to the responding/feedback page.
0
 

Accepted Solution

by:
lakshmisubram earned 400 total points
ID: 7144125
Does the below code help you ?

<html>
<head>
<script language="JavaScript">
function submitForm()
{
  if (document.test.helpneeded[0].checked)
  {
   

document.test.action="http://www.experts-exchange.com";
  }
  else if (document.test.helpneeded[1].checked)
  {
    document.test.action="http://www.yahoo.com";
  }
}
</script>
</head>
 
<form name="test">
<input type="radio" name="helpneeded" value="yes">yes
<input type="radio" name="helpneeded" value="no">no
<input type="submit" name="submit" value="Submit"

onClick="submitForm();">
</form>
</html>
0
 

Author Comment

by:jamaica
ID: 7146985
From: lakshmisubram  Date: 07/10/2002 10:40AM PST  

Even though this is not the way I really want it but I have the option of doing it this way...

I'll award you with this, as it better works out what I'm working on. I now have 3 html pages. The first/intro page asks user to select an appropriate radio button "Yes|No".

If user selects Yes, then he's sent to Pg1.html that uses cgi perl post method and encoded return page yes_ret.html

If user selects No, then he's sent to Pg2.html that uses cgi perl, method=post and encoded return page no_ret.html.

Thank you.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

715 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