utfrmgn2.wbb - Generate a Complete HTML Form from a Template


CALL "utfrmgn2.wbb",tpl$,flds$,captions$,flags$,captags$, actionval$, submitval$, resetval$, placement,work$


This program uses the utfrmgen.wbb program to create a form and adds the submit and reset buttons and form action tags to create a complete HTML input form.

It is also capable of creating the form as loose text, preformatted and aligned text, or as a bordered or borderless table.




Data tempate that contains both the fields and data to generate the form input fields. A variety of user-attributes can be defined in the template to control how field data is handled. See the Data Templates for an explanation of these attributes.


Text string that contains a comma-delimited list of field names and optional format options. If flds$ is null, then a default list is generated from all the fields in tpl$. flds$ can refer to individual array elements (name-n) or to all array elements (name-*), in which case the form is generated with all defined array elements separated by a <BR> tag within the column. If flds$ begins with "*,", it is assumed to contain a list of exceptions, so that all the fields in the template tpl$ are used to generate the HTML output. Those found in flds$ are referenced with the formatting tags included in flds$ (for example, if flds$ contained the data "*,type checkbox keys="1;2" vals="Type 1;Type 2"", then all fields in the template would be generated, and the field "type" would be treated as a checkbox input.) See the utfrmout.wbb program documentation for formatting options.

Any "field" that begins with "<" is assumed to be fixed HTML that is added to the document generated. If a table format is being generated, the field is allocated a full row, using "<td colspan=2>" when creating that particular row. If flds$ begins with "!,", then all fields in the template except those listed after the first comma are included in the generated document.


String template that contains captions for any field to be included in the form (any in flds$, or if flds$ is null, then any field in tpl$.) The data for any field found in captions$ is used as the caption for the field. If a field to be used on the form is not present in captions$, and the user attribute "caption" is not present in the template, a default caption is generated from the field name by converting underscores to spaces and formatting the name with proper case. A null field in captions$ results in no caption for that field.


Text string containing formatting controls, each separated by at least one space, in any order. The supported flags are listed in the table below.


Text string that contains any tag used to format the captions before being placing in HTML form. This string is used in a CALL to uttags.wbb. Refer to that program page for additional information.


Name of the script to execute when the submit button is pressed. All forms contain a tag similar to <form method="post" action="actionname">. The text in actionval$ is used for actionname.


Caption used on the submit button(s). If this is null, the browser places its own caption on the button.


Caption used on the reset button(s). If this is null, no reset button is created on the form.


Value used to determine the location of the submit and reset buttons. The following values are valid:

1 = Below form

2 = Above form

3 = Both above and below form

Add 100 to these values for a horizontal rule and to separate the buttons from the form body.


Text string that returns the HTML version of the form. This form is incomplete as returned and needs a submit button and the <form> </form> HTML tags. It may be necessary to use this feature to build a form from several data templates.





Formats the captions and input fields in table columns, one row per field.


Use pre-format tags to format the form, allowing perfect column alignment without relying on table structures but using fixed pitch fonts.


Indicates there should be extra space between each row.

align=left, center, right

Sets horizontal alignment for table captions.

cellalign=left, center, right

Sets the horizontal alignment for table data cells.

valign=top, bottom

Sets vertical alignment to "top" or "bottom" for tables.


For table forms, there should be a border around each cell.

hdropt=options cellopt=options

Adds options to the <th> and <td> tags, respectively. No spaces are allowed, but underscores can be used for multiple options. "hdropt=bgcolor=red_align=right", for example, generates <th bgcolor=red align=right>.

font=fontopts hdrfont=fontopts

Adds a <font fontopts> tag to each data cell and caption cell, respectively. Use underscores for spaces. For Example, "size=4_color=black" adds <font size=4 color=black> and </font> tags to the data.


Captions are placed to the right of the input fields.


Captions are placed above the input fields. In addition, if "pre" or "table" is specified, the data is arranged in columns, and array values in the template are scrolled within the column.

If utfrmgn2.wbb recognizes any field types of "type=file", the <form> tag is created with the enctype=multipart/form-data option to support file uploading. utcgi.wbb is compatible with this attribute, but only modern browsers support it (i.e., Netscape Navigator 3.0 or above, Microsoft Internet Explorer 3.0 or above.)