Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CGI and HTML

Posted on 1997-11-02
4
Medium Priority
?
321 Views
Last Modified: 2013-12-25
In this piece of code, I am trying to get the user's reply on whether to proceed with data retrieval.

----------- My C code ------------

// PrintConfirmRefreshPage
//
// Pops up a Confirmation Dialog Box asking whether the
// user to proceed with data retrieval.
//
// Input :
//            Nil
//
// Output :
//            This function gets the user's confirmation on Refresh.
//            If Refresh is required, then call PerformFunction
//            with RefreshFlag set to 1. Else do nothing.
//


#include <stdio.h>

void PrintConfirmRefreshPage()
{
      // print out the header info
      printf("Content-type: text/html\n") ;
      printf("<html>\n");
      printf("<body BGCOLOR=\"#FFFFFF\">\n");

      printf("<FORM NAME=\"RefreshForm\" ACTION=\"https:/xyz/cgi-bin/PerformFunction.exe\" METHOD=\"GET\">\n");

      //      PerformFunction.exe needs the following parameters to execute
      //      the appropriate CGI programs.  Use Hidden so that the fields
      //      will not be displayed on the form.

      printf("<INPUT TYPE=HIDDEN NAME=Function VALUE=GetOnlineInfo>\n");
      printf("<INPUT TYPE=HIDDEN NAME=Refresh VALUE=1>\n");
      printf("</FORM>\n");

      printf("<script language=\"JavaScript\">\n");
      printf("      var ok = null;\n");
      printf("      ok = confirm(\"No data is found in local database. \\r\\nDo you still want to retrieve data from Remote database NOW?\"); \n");
      printf("      if (ok == true) { \n");
      printf("            form.submit(); \n");      // submit the form
      printf("      } \n");
      printf("</script>\n");

      printf("</body>\n);
      printf("</html>\n);

}

-------------- End ---------------

If the OK button is clicked, i would like to execute a CGI program.  I do this by using form.submit().  However, when the program is run and the OK button is clicked, the following error message is displayed:

JavaScript Error
https://servername/dirA/cgi-bin/PerformExecution.exe?Function: GetOnlineInfo
Form is not defined

Is form.submit() being used correctly?  If not, how can i submit the form in the above situation?  I would like to use a confirmation dialog box instead of a submit object (e.g. submit button) in my module.

Any help is greatly appreciated.
0
Comment
Question by:daffygirl
[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
4 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1831062
try document.RefreshForm.submit()
0
 
LVL 7

Accepted Solution

by:
faster earned 300 total points
ID: 1831063
modify the line

printf(" form.submit(); \n"); // submit the form

as:

printf("document.RefreshForm.submit(); \n");
0
 
LVL 7

Expert Comment

by:faster
ID: 1831064
Sorry, I didn't notice ozo's comments.  He actully already gave the right answer.
0
 

Author Comment

by:daffygirl
ID: 1831065
Thanks for the help.  It works, but it always seems to give the 'Transfer Interrupted' message first, before the form appears.  But anyway, thanks again!  At least it works now.  :o)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

715 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