Gform 1.0a for Windows
Gform 1.0 is copyright 1994 by Joey Hess. It is a modification of gform for Unix by Harry Raaymakers.
Gform is freeware - you are free to use this program and give it to others, provided you do not modify the program in any way. You may modify the program for your personal use.
The problem with forms is that they all need their own program to handle
the fields in the form. Most often you want to collect submitted forms
in a file or send it through the mail. The creation of individual form
programs can be a pain.
Gform is designed to make creating forms handling program simple.
In your HTML form you specify the FORM 'ACTION' to be 'gform', and
as parameter you pass it the pathname of the form.
In the HTML tag set there is a tag for comment <! .. >. What gform
does is read comments that start with <!gform ....>. These special
comments contain commands for gform. Any number of these <!gform ..>
comments maybe used.
There are 2 types of <!gform ...> commands.
- Text strings
A series of text strings build up a message that can later be
saved to a file. For example:
<!gform "Thanks for your message!">
- Keywords
Keywords control where and how the form data is handled.
- This will put the results of a series of gform text strings in the file "\path\of\file"
<!gform deliver=file "\path\of\file">
- This will append the results of a series of gform text strings to the end of the file "\path\of\file"
<!gform deliver=append "\path\of\file">
- The following will display the HTML file '\web\thanks.html' after the form has been submitted.
<!gform reply="\web\thanks.html>
Note that after a deliver command saves something to a file,
it erases it from memory. You can have several deliver commands
in a single form, and each can save different lines of text to a file. Here is an example.
Variables start with a '$' sign followed by the variable name as
specified on the HTML INPUT tag in the HTML file. They are
are terminated with a '$' sign. The varables you use
must be specified in the INPUT tags. You do not have to use
all the variables.
Variables can be used in any gform command inside quote characters, ie.
in a text string or in a reply or deliver filename.
There are several special variables that are built into gform.
- $date$ -- insert the date
- $times$ -- intert the time
- $n$ -- new line
- $t$ -- tab
- { -- automagically changed to the < character
- } -- changed to the > character
Take the form file below and notice the <!gform> comments
There are several variables given by the INPUT tags.
They are then addressed as $id$, $pin$, $field3$ etc.
in the <!gform> commands.
In particular note how parameters are passed to a program
from a HTML file ( ie. the line
"<FORM method=POST action="/cgi-win/gform.exe?/pub/htm/feedback.html">"
has /pub/htm/feedback/htm as the parameter to gform which should be
the pathname of the current form.)
<HTML>
<HEAD><TITLE>Feedback</TITLE></HEAD>
<BODY>
<FORM METHOD="POST" ACTION="/cgi-win/gform.exe?/pub/htm/feedback.html">
From:<INPUT TYPE="text" NAME="from">
Subject:<INPUT TYPE="text" NAME="subject"><P>
Message:<P>
<TEXTAREA NAME="message" ROWS=10 COLS=60></TEXTAREA><P>
To submit your message, press this button:
<INPUT TYPE="submit"VALUE="Submit Comments"><P>
To clear the form, press this button:
<INPUT TYPE="reset"VALUE="Clear Form">
</FORM>
<!gform "----------------------------------$n$">
<!gform "Date: $date$">
<!gform "From: $from$$n$">
<!gform "Subject: $subject$$n$">
<!gform "Message Body:$n$$message$$n$">
<!gform deliver append="c:\feedback\wwwmsg.txt">
<!gform "{title}Thanks for Your Feedback!{/title}$n$">
<!gform "{h1}Thanks for Your Feedback!{/h1}$n$">
<!gform "Your message has been processed and saved,$from$$n$">
<!gform "I'll read it and get back to you as soon as possible.{P}$n$">
<!gform "{HR}{I}This form was processed by GFORM by Joey Hess.{/I}{P}">
<!gform deliver file="c:\pub\htm\gform\thanks.html">
<!gform reply="/gform/thanks.html">
</BODY>
</HTML>
Notice that the above file uses two deliver commands. The first appends
the message created by the series of text strings to "c:\wwwmsg.txt",
for later reading. Then that message is erased, so a new one can be built
up, to thank the user for sending feedback. Notice also that this message is
customized with the user's name ($from$). This message is written to the
file "c:\pub\htm\tmp\thanks.html".
The reply command causes the file "c:\pub\htm\tmp\thanks.html" to be
sent to the user's browser. Alternatively, you could write a stock reply file
that the form always replies with. This would be faster than creating one on the fly,
but a personal touch is nice.
When you put things up on the web, it's improtant to be security conscious.
Be warned that if gform is set up incorrectly, it has the potential to be
a security hazard on your computer.
To address this problem, gform comes with a file, security.dat, which contains
information about what parts of your computer gform is allowed to write to.
The file is just a list of directories, where each directory on the list is one
where gform is allowed to deliver files. See installing gform
for information and advice about setting up the proper subdirectories.
If it is set up properly, gform will not allow users to read or write unauthorized files to
your computer.
To install gform, you will need to have already installed a web server program
that supports the CGI MS Windows Interface version 1.1. HTTPD for windows supports
this interface, there may be others. I have placed information appropriate to HTTPD in brackets to make things easier for HTTPD users.
- Put all the gform files (gform.exe, gform.html, gform.ini, and security.dat) in the
directory that your server uses for windows cgi [\httpd\cgi-win\].
- Edit the gform.ini file and change the "LogLocation" line to point to
where you want gform to keep its log. [LogLocation=c:\httpd\cgi-win\gform.log].
- While you're looking at the INI file, you might want to change the loglevel, as is explained in the file.
- Make a gform directory under the directory where you keep your web pages.
Gform will use this directory as a place to deliver files to.
This directory must be world-readable from your web server.
You can also set up other directories for gform to write to, ie. a feedback
directory as in the example.
- Edit the security.dat file, and add lines corresponding to the directories you created in the last step. Be sure that you don't add the names of any directories you don't want gform to be able to write to.
- Now you're ready to write the forms that use gform. As a first step, you can copy the gcomment.html file (included in the gform zip file) into your web page directory, and change the paths in its deliver and reply commands to match the
correct paths on your computer. After you've gotten it working correctly, you can go on to write your own forms. Good luck!