quisp: working with html forms

quick server pages
| Manual page for working(with)

## Working with HTML forms

One of QUISP's main strengths is HTML forms work. This document assumes that you already know how to code HTML forms.`` Two QUISP pages must be set up to implement a form. The first is the form page; it contains the form. The second is called the target page; it is invoked when the user "submits" the form, and has all of the user responses available as variables.`` The target page may build SQL statements to save submitted data.`` Or, it may just issue a query based on the submitted parameters. Sometimes with the latter, the form and target pages are actually the same page, invoked cyclically.``

A basic example using form `<INPUT>` fields is shown below.

QUISP also provides additional support (documented separately) for:

- SELECT option lists (single and multi choice) using #optionlist
- TEXTAREA fields using #showtext and #savetext
- Big lists of checkboxes (etc.) using #allresponses

## Working examples

Located here (also in your `./qexamples` directory).``

## A basic form and target page

Suppose we have the following HTML form with several `<INPUT>` fields.`` The form method is `GET` but `POST` can also be used.``

       <form action="@CGIPROG" method=GET>
       #formtarget mytarget
       Enter your first name:
       <input name=firstname value="" size=20 maxlen=20> <br>
       Enter your last name:
       <input name=lastname value="" size=20 maxlen=20> <br>
       <input type=submit>
       </form>

The target page for the above form should be in a file in the `./pages` directory named `mytarget`, and might look something like this:

       #cgivar firstname, lastname
       <h1>Hello, @firstname @lastname!!</h1>

A more elaborate data entry form example that includes database access is shown at the bottom of this page. Here are the descriptions for the basic HTML form QUISP directives:

## #formtarget

This directive should be used within the `<form>` construct. It specifies the name of the page that will be used to capture submitted responses and do something with them, such as save them to a database. The page name is relative to the `./pages` directory.`` This directive works by generating a "hidden" form input field called rtn.``
Example: `#formtarget saver`

## #pass

May be used to pass variable(s) from the form page to the target page.`` Useful when information is needed by the target page in addition to that provided by the submitted form fields. Note that variable names should not be specified with a leading at-sign (`@`).`` This directive works by generating "hidden" form input fields.``
Usage: `#pass` varname1 .. varnameN
Example: `#pass parm1, parm2`

## A data entry form example

Located here
quick server pages
Copyright Steve Grubb

Markup created by unroff 1.0, `` `` April 13, 2004.