Using the Docbase Form Generator

The form generator, formgen.pl, runs as a CGI script. It requires at least one argument, which tells the generator which instance of Docbase to use. For example, the CGI call:

/cgi-bin/Docbase/formgen.pl?app=ProductAnalysis

produces the form shown in Figure 6.1.

Default ProductAnalysis input form

Figure 6-1. Default ProductAnalysis input form

The assignment date, overridden by the |assigndate| marker, appears as static text. All other fields are open for input. However, this CGI call:

/cgi-bin/Docbase/formgen.pl?app=ProductAnalysis&duedate=1999-05-01&
  analyst=Jon%20Udell&company=Netscape&product=Collabra%20Server%204.0

produces the form shown in Figure 6.2.

Customized ProductAnalysis input form

Figure 6-2. Customized ProductAnalysis input form

Here, the generator, using the services of the Docbase::Input module, has overridden every replaceable marker with a computed or preassigned value. The analyst who completes this form needs to fill in only four of the fields: Title, Summary, Full Report, and Contact Info.

The form generator, formgen.pl, appears in Example 6.2. It’s brief, because most of the work is done by two modules: TinyCGI and Docbase::Input.

Example 6-2. The Docbase Form Generator

#!/usr/bin/perl -w use strict; use TinyCGI; # load basic CGI services my $tc = TinyCGI->new(); print $tc->printHeader(); my $vars = $tc->readParse(); ...

Get Practical Internet Groupware now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.