Solved

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

Posted on 2004-04-14
9
192 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

758 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

19 Experts available now in Live!

Get 1:1 Help Now