Solved

pass a js variable to CGI

Posted on 2000-05-08
5
281 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
  • 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Python 2.7 - French characters 6 104
ICACL switch help. How to include current folder 2 51
Set robocopy to exclude "System Volume Information" folder 3 123
ROBOFTP UNZIP 1 53
The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

856 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