Solved

pass a js variable to CGI

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
The viewer will learn how to dynamically set the form action using jQuery.
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.

920 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

14 Experts available now in Live!

Get 1:1 Help Now