Help

Forms

Forms provide a mechanism for readers of your Web page to submit information in categories. For example, one of the forms in an electronic mail order company would allow the customer to specify name, address, credit card number, telephone, etc. This section explains how you create forms.

Quick Start


Create a form within a Format->Form...

page

Insert a form element Click appropriate button on

into a form form palette:

Radio button Radio

Check box Check

Text field Text

Text area field TArea

Selection List Slist

Image field Picture

Reset Reset

Submit Submit


Starting Points

Ad Hoc Forms and CGIs

GNNpress allows even a novice user to create and edit forms within an HTML document, but using the results that are submitted from a form requires a bit more work. The creator of the Web page can design the form, but someone with access to the NaviServer or GNN Hosting Service has to write a program, such as a NaviServer Tcl script or a CGI script, to handle the information passed.

The process that handles the information submitted by the form must be remote, and we cannot help you build it or install it. You must talk to your NaviServer system administrator to have your shell script placed in the server's CGI directory(ies). The Common Gateway Interface (CGI) runs external programs, or gateways, under an information server.

For more information on CGI and forms, look at

CGI scripts might break the server's protection mechanism, because they run on the server and can access files on the server with a uid that is not yours. Therefore installing them is an operation that must be performed carefully.

For more information and examples of CGI scripting, see CGI/1.1 script support of the CERN Server at http://www.w3.org/hypertext/WWW/Daemon/User/CGI/ Overview.html.

Database Forms

Before you spend your weekend learning and writing CGI scripts to handle your form data, it is more useful and easier to use a table in the NaviServer database. Given access to a NaviServer, you can create a searchable table in the NaviServer database and its columns (fields), customized using Tools->Administer Server. The entry form can then be edited, incorporated into another HTML document, and saved elsewhere. The submitted data are then in the NaviServer database where they can be easily searched, ordered, and updated.

Layout and Design

A Form has Field Elements that are inserted into a form by clicking the button on the form palette to produce the desired dialogue box. Setting the attributes in the field element dialogue and clicking OK inserts a form element at the cursor position within the form. GNNpress allows you to create eight types of field elements: Text Fields, Radio Buttons, Check boxes, Text Areas, Selection Lists, Picture Fields, Reset buttons, and Submit buttons. Each field element needs to have a Form Tag (you can think of it as analogous to a variable name in a computer program) to identify the field when the results are sent to the form handler. See the Form Palette section.

More than one form may be created within an HTML document, but forms cannot be nested. The Form palette is visible when the cursor is inside the form and disappears when the cursor is outside of the form.

Text, images, links, etc. can be inserted and modified in the form just as in the rest of the page. Form elements can be dragged-and-dropped or cut-and-pasted, but must always be placed within a form.

Create Input Forms

Assuming there is a CGI shell script installed, here is a description of what you should do.


Create a form that will drive the CGI script:

Form dialogue

  1. Bring up the menu Format->Form... to get the dialogue box above.

    It has two items of interest:
  2. Specify the Method. The choices are GET and POST. Most servers (all NaviSoft servers) support both GET and POST; older servers may only support GET. You should use POST if you can, because it allows bigger transmissions. The returned format of the form data is slightly different depending on whether the data came in a GET or a POST.

    GET causes the filled-out form contents to be appended to the URL as if they were a normal query, POST causes the filled-out form contents to be sent to the server in a data body rather than as part of the URL.
  3. Specify the URL of the Form Handler Location (having specified the access Method) and press OK.
    Unfortunately, you cannot tell if you have entered a valid URL until you submit a form.

    Two dotted lines appear surrounding the line that the cursor is on and the Form Palette appears containing 8 buttons for field elements. The area between the two dotted lines is the form that you have created in the document.
  4. Click the cursor inside the form on the page (between the dotted lines) to make the Form Palette visible. Click the cursor on the page, outside the form, to make the Form Palette disappear.
  5. Display or hide the dotted boundary of the form with the Hide Borders/Show Borders option in the Format menu. This also displays/hides the dashed borders around lists. It is useful and common to place Horizontal Rules to help distinguish the borders of a form within a page.
  6. Click Format->Exit Form Format when the form is at the bottom of the page and there is nothing beneath the form to click into, and you want to exit the form.
  7. Use the option Format->Remove Form Format to remove the form. You must remove all form elements first, but the software reminds you to do this.

Page, after initializing form

More than one form may be created within an HTML document, but forms cannot be nested.

Help Contents