Local CGI

With online web sites, you can write Web applications which process form input and produce resulting pages which are then sent back to the browser. This is usually done using "Common Gateway Interface" (CGI) calls. Local CGI gives the Ebook the same capability, except that the crafting of Local CGI applications is usually much easier than the online variety!

Just as with regular CGI, a Local CGI call is defined using the <FORM> tag's Method and Action attributes, e.g.

    <form Action="notepad.exe" Method="output.htm">

The above statement tells the Ebook that when the submit button on the form is pressed, it should:

  1. Store the form data in output.htm.
  2. Run the notepad.exe program with "output.htm" as parameter.
  3. If the file created for the Ebook is modified within 30 seconds, the Ebook will reload the file. This is useful if you need to generate HTML pages, in response to a user's request.

You can also use the HREF tag for a Local CGI call:

    <A HREF="myprog.exe CGI=output.htm ITEM1=ALFA ITEM2=BETA">Submit CGI</A>

This will generate a file with the following two lines:

     ITEM1=ALFA
     ITEM2=BETA

Where files are located when using Local CGI

EXE files referenced in Action statements (and also in direct HREF links) are assumed to be:

  1. in the specified path if an absolute path is given
  2. in or relative to the publication location
  3. otherwise assumed to be on the system path

Form data is located in the Windows temporary directory and automatically erased once the CGI call is finished.

If the program that handles the CGI calls was compiled into the Ebook, it also will be temporarily saved to the temporal directory as the CGI Call is done.

Once you know how to call your Local CGI program, you need only write the code to process the form data file. Then have the program generate an HTML response page and open it in the Ebook.

The form data file full path and name will be provided to the Local CGI program as a command line parameter.

After that Local CGI programs loads and processes the form data file, it should generate and save its response overwriting the form data file.

After that, the Ebook will detect that the form data file changed, and will load and show the result generated by your Local CGI program inside the Ebook screen.

Note: The program for processing the Local CGI call should be made for that specific purpose. We cannot make it, but we provided an example to guide the programmers at:

http://bersoft.com/hmhtml/localcgi.zip