|
| 9.3 Generating HTML Forms |
|
Forms permeate Web applications, and Vortex was designed with this
in mind.
Lists
As we've seen, the list nature of Vortex variables lends itself
to form management.
Automatic import
Vortex variables are automatically imported from form variables
of the same name; no init call is needed.
Automatic HTML escapement
On output, Vortex variables are automatically HTML-escaped,
obviating the need for text-variable escapement.
Vortex also has some functions to make generating forms easier.
- <options>
The <options>
function, as we used in the Variable Values
section, automatically generates a list of <OPTION>
tags for a <SELECT>
box.
- <checkbox>
This generates a list of <INPUT TYPE=checkbox>
boxes.
As with <options>
, certain boxes can be pre-selected from
a variable.
- <radiobutton>
The <radiobutton>
function does the same for radio buttons.
Image maps
Since periods are valid variable name characters, server-side image
map coordinates can be obtained directly from the form variables
(eg. $map.x
/ $map.y
).
File uploads
Vortex also automatically imports variables from form-based
file uploads - forms with ENCTYPE=multipart/form-data
.
This makes uploading of files and images directly into Vortex
variables easy. We'll discuss this in the section on
Multi-part File Uploads
.
|