Solved

pass a js variable to CGI

Posted on 2000-05-08
5
284 Views
Last Modified: 2013-12-25
I need a confirm window for the CGI, I want to use confirm() function in JS. How do I pass return value of confirm() to my cgi program? Can anybody give me a sample code please?

Thanks,
0
Comment
Question by:Embt
[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
  • 2
  • 2
5 Comments
 

Expert Comment

by:hualian
ID: 2790720
this is html code
<FORM method="GET" action="mycgi.cgi" onsubmit="confirm_mesg()" ;>

<script language="JavaScript">
<!--
function confirm_mesg() {
confirm("do you really want post form?\n");
}
//-->
</script>


if you still have problem,please say.
My icq is 18634452
0
 

Author Comment

by:Embt
ID: 2793075
Thanks for response. My problem is I need to pass the result(which is true of false) of confirm() to my CGI program. how do I do this?
0
 
LVL 1

Accepted Solution

by:
lambda earned 50 total points
ID: 2795473
Try this

<script LANGUAGE="javascript">
function callIt ()
{
      val1 = confirm ("Yes or no?");
      document.frm1.action="http://your.domain.com/cgi-bin/j_test.cgi?value1=blah&value2="+val1;
      document.frm1.submit;
      return false;
}
</script>

:
:
<form name="frm1" onSubmit="callIt ()">
:
:
<input type="submit" name="btnSubmit" value="Click">
</form>

________________________________________________________________________________________________________________
0
 
LVL 1

Expert Comment

by:lambda
ID: 2795490
Change the form tag :

<form name="frm1" method="post" onSubmit="callIt ()">

0
 

Author Comment

by:Embt
ID: 2811086
sorry for the rejection.

I haven't tested out lambda's proposed answer, but it looks like works. so I'll give the credit to him/her
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
issue with beginner powershell script. 5 76
Awk : two files math 8 29
Convert .csv to tab delimited text 11 51
Powershell GUI 11 66
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
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…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

730 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