Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

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

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
lengel1
Asked:
lengel1
  • 2
  • 2
  • 2
  • +1
1 Solution
 
TintinCommented:
What do you mean by a "ok_url"?

Do you mean multiple submit buttons with different actions?
0
 
mishagaleCommented:
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
 
lengel1Author Commented:
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

 
mishagaleCommented:
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
 
akashwizCommented:
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
 
akashwizCommented:
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
 
lengel1Author Commented:
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now