?
Solved

pass a js variable to CGI

Posted on 2000-05-08
5
Medium Priority
?
288 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 150 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

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

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

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to count occurrences of each item in an array.
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 …
Suggested Courses

752 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