.ig >>
<STYLE TYPE="text/css">
<!--
        A:link{text-decoration:none}
        A:visited{text-decoration:none}
        A:active{text-decoration:none}
        OL,UL,P,BODY,TD,TR,TH,FORM { font-family: arial,helvetica,sans-serif;; font-size:small; color: #333333; }

        H1 { font-size: x-large; font-family: arial,helvetica,sans-serif; }
        H2 { font-size: large; font-family: arial,helvetica,sans-serif; }
        H3 { font-size: medium; font-family: arial,helvetica,sans-serif; }
        H4 { font-size: small; font-family: arial,helvetica,sans-serif; }
-->
</STYLE>
<title>quisp: working with html forms</title>
<body bgcolor=99cc99 vlink=0000FF>
<br>
<br>
<center>
<table cellpadding=2 bgcolor=FFFFFF width=550 ><tr>
<td align=right><a href="quisp_home.html">
<img src="img/quisp2.gif" border=0><br><small>quick server pages</a> &nbsp; &nbsp; </td></tr>
<td>
.>>

.TH working with html forms TDH "13-APR-2004   TDH scg@jax.org" 

.SH Working with HTML forms
One of QUISP's main strengths is HTML forms
work.  This document assumes that you already know how to code 
.ig >>
<a href="http://archive.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/fill-out-forms/overview.html">
.>>
\0HTML forms.
.ig >>
</a>
.>>
Two QUISP pages must be set up to implement a form.  The first is the \fBform page\fR; it contains 
the form.  The second is called the \fBtarget page\fR; 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.
.LP
A basic example using form \fC<INPUT>\fR fields is shown below. 
.LP
QUISP also provides additional support (documented separately) for:
.IP \(bu
.ig >>
<a href="oplist.html">
.>>
\0SELECT option lists (single and multi choice) using #optionlist
.ig >>
</a>
.>>
.IP \(bu
.ig >>
<a href="oplist.html">
.>>
\0TEXTAREA fields using #showtext and #savetext
.ig >>
</a>
.>>
.IP \(bu
.ig >>
<a href="allresponses.html">
.>>
\0Big lists of checkboxes (etc.) using #allresponses
.ig >>
</a>
.>>

.ig >>
<br><br><br>
.>>
.SH Working examples
.ig >>
<a href="http://quisp.sourceforge.net/cgi-bin/quisp?rtn=index">
.>>
\0Located here
.ig >>
</a>
.>>
(also in your \fC./qexamples\fR directory).

.ig >>
<br><br><br>
.>>
.SH A basic form and target page
Suppose we have the following HTML form with several \fC<INPUT>\fR fields.
The form method is \fCGET\fR but \fCPOST\fR can also be used.
.nf
 \0 <form action="@CGIPROG" method=GET>
 \0 #formtarget mytarget
 \0 Enter your first name: 
 \0 <input name=firstname value="" size=20 maxlen=20> <br>
 \0 Enter your last name: 
 \0 <input name=lastname value="" size=20 maxlen=20> <br>
 \0 <input type=submit>
 \0 </form>
.fi
The \fBtarget page\fR for the above form should be in a file in the \fC./pages\fR directory
named \fCmytarget\fR, and might look something like this:
.nf
 \0 #cgivar firstname, lastname
 \0 <h1>Hello, @firstname @lastname!!</h1>
.fi

.LP
A more elaborate 
.ig >>
<a href="#de_example">
.>>
\0data entry form example
.ig >>
</a>
.>>
that includes database access is shown at the bottom of this page.  
Here are the descriptions for the basic HTML form QUISP directives:


.ig >>
<br><br><br>
.>>
.SH #formtarget
This directive should be used within the \fC<form>\fR 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 \fC./pages\fR directory.
This directive works by generating a "hidden" form input field called \fBrtn\fR.
.br
Example: \fC#formtarget saver\fR

.ig >>
<br><br><br>
.>>
.SH #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 (\fC@\fR).
This directive works by generating "hidden" form input fields.
.br
Usage: \fC#pass  \fIvarname1\fR .. \fIvarnameN\fR
.br
Example: \fC#pass parm1, parm2\fR

.ig >>
<a name=de_example></a>
.>>
.ig >>
<br><br><br>
.>>

.SH A data entry form example
.ig >>
<a href="http://quisp.sourceforge.net/cgi-bin/quisp?rtn=index#readwritedb">
.>>
\0Located here
.ig >>
</a>
.>>


.ig >>
<br>
<br>
</td></tr>
<td align=right>
<a href="quisp_home.html">
<img src="img/quisp2.gif" border=0></a><br>
<small>quick server pages &nbsp; &nbsp;<br>
<a href="Copyright.html">Copyright Steve Grubb</a> &nbsp; &nbsp;
</td></tr>
</table>
.>>

