Solved

Can a single form have multiple "ok_url"s based on form_id options?

Posted on 2004-04-14
9
197 Views
Last Modified: 2013-12-25
Hi,

Is there a way in a form to identify more than one "ok_url" triggered by a "form_id" "option"?

I am a beginner and need help figuring this out. I have to use a supplied cgi script that works on the back end.

In my form I have a pull down menu in which the "form_id" has multiple "options". These options are returned in the subject line of the "submit_to" email that I receive.

Since I can't rewrite the cgi (even if I knew how to) I thought maybe there was a way to name the "options" uniquely and have that related somehow to the "ok_url". Then I would make multiple pages that would respond to what ever option was submitted by the user.

Does this make any sense? Can you help?
0
Comment
Question by:lengel1
  • 2
  • 2
  • 2
  • +1
9 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 10828019
What do you mean by a "ok_url"?

Do you mean multiple submit buttons with different actions?
0
 
LVL 2

Expert Comment

by:mishagale
ID: 10835620
If your not prepared/able to modify the CGI, there isn't really a way to do this.
Can you post the code of the script you have here? If it's not to complex, maybe someone here will modify it for you.
0
 

Author Comment

by:lengel1
ID: 10838224
To answer Tintin: There is only one submit button. There will be a pull down menu with options. This is set to the form_id. This is optional feature fills the subject line of the email received in the submit_to line.  

Let's say there are four options set in the <select><option>, Driving Class A, B, C or D. If someone used the pull down menu and selected Driving Class A, then hit the submit button, I would have a relevent unique page called with the ok_url that  has information about Driving Class A. There would be four different ok_url's which in turn hook up to four different html pages relevant to the chosen option (Driving Class) content.  This would be a smoke and mirrors version of a dynamic web experience.

In answer to mishagale, I am not permitted to change the CGI. It's controlled by IT and they won't let others touch it.

That's why I was trying to think of a work around to get some savvy function out of what I need to do,  because IT won't help me.

Does this make sense?

lengel1
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 2

Expert Comment

by:mishagale
ID: 10838641
Ok, your description of this problem is very confusing, so let's see if I have this correct:

1. You currently have a CGI which e-mails you a user's selection from a drop-down list
2. You want to use this CGI to redirect the user to a different page
3. You are not able to modify the CGI

If this is correct, then you are up **** creak with no paddle. If not, could you please explain further.

Out of idle curiosity, if you don't work in IT, why are you working with CGI scripts?

Misha
0
 
LVL 1

Expert Comment

by:akashwiz
ID: 10851959
When you cannot modify the server-side script (the cgi script), you are only left with some client-side programming in your web page (JavaScript). Initially you can give a blank value to ok_url as shown in code below. Then as the visitor clicks any radio button, the value of ok_url gets changed by the script. If he/she doesn't select any radio button and submits the form, a alert message is shown. Analyze the code below after pasting it in some text editor like wordpad. Read the comments in the JavaScript code. I hope this helps.  


<html>
<head>
<title></title>
<script language="JavaScript">
<!--

// supply the ok_URL's for different values of form_id.

url_a = 'http://a.com';
url_b = 'http://b.com';
url_c = 'http://c.com';
url_d = 'http://d.com';

function formsubmit()
{
// alert if user has not choosen a option

if (document.myform.ok_url.value == '')
{
alert('Please choose a option first.');
return;
}

// else submit the form

document.myform.submit();

//-->
}

</script>
</head>


<body>

<form method="POST" action="http://mysite.com/myform.cgi" name="myform">
<p><input type="radio" name="form_id" value="a" onclick="document.myform.ok_url.value = url_a"></p>
<p><input type="radio" name="form_id" value="b" onclick="document.myform.ok_url.value = url_b"></p>
<p><input type="radio" name="form_id" value="c" onclick="document.myform.ok_url.value = url_c"></p>
<p><input type="radio" name="form_id" value="b" onclick="document.myform.ok_url.value = url_d"></p>

<input type="hidden" name="ok_url" value="">  
 
<input type="button" value="Click me" name="s" onclick="formsubmit();">
</form>

</body>
</html>
0
 
LVL 1

Accepted Solution

by:
akashwiz earned 500 total points
ID: 10851966
Same code as above but with A, B, C, D written besides the radio buttons to distinguish between them.

<html>
<head>
<title></title>
<script language="JavaScript">
<!--

// supply the ok_URL's for different values of form_id.

url_a = 'http://a.com';
url_b = 'http://b.com';
url_c = 'http://c.com';
url_d = 'http://d.com';

function formsubmit()
{
// alert if user has not choosen a option

if (document.myform.ok_url.value == '')
{
alert('Please choose a option first.');
return;
}

// else submit the form

document.myform.submit();

//-->
}

</script>
</head>


<body>

<form method="POST" action="http://mysite.com/myform.cgi" name="myform">
<p>A. <input type="radio" name="form_id" value="a" onclick="document.myform.ok_url.value = url_a"></p>
<p>B. <input type="radio" name="form_id" value="b" onclick="document.myform.ok_url.value = url_b"></p>
<p>C. <input type="radio" name="form_id" value="c" onclick="document.myform.ok_url.value = url_c"></p>
<p>D. <input type="radio" name="form_id" value="b" onclick="document.myform.ok_url.value = url_d"></p>

<input type="hidden" name="ok_url" value="">  
 
<input type="button" value="Click me" name="s" onclick="formsubmit();">
</form>

</body>
</html>
0
 

Author Comment

by:lengel1
ID: 10877487
Dear akashwiz,

You understood my question exactly! That's precisely what I wanted to know how to do. I am going to try it and confirm it works!

Thank you,
lengel1
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Powershell Find Folders 7 53
How to count json data 2 76
Sums of coloumns in html/java 15 76
change the windows script file to BAT 10 40
In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

770 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