HTML 3 Forms and Scripts
Fill-out forms have been very successful, but now people are beginning to
discover their limitations. Here are some of the things you can't do currently
with fill-out forms:
- Dependent Choices
- Where earlier choices effect the options for subsequent choices
- Constrained values
- Where particular fields require values conforming to specified patterns
- Calculated Values
- Spreadsheet style formulae, that update dynamically when related fields
are changed
Right now, you would have to get the user to submit the form so that a server
script or program can apply the necessary logic. This is both slow and
cumbersome. In many cases, the network delays may last several seconds, and
the user will then see the screen "flash" as the updated form is
displayed. The solution is to associate forms with scripts that are
interpreted by the client rather than the server.
Client-Side Scripts
HTML 3 Scripts are strictly limited in their interactions with the browser
and the host system. This is essential to preventing hackers from slipping a
"mickey finn" into your system. The following kinds of actions are permitted
from within scripts:
Field Values
Scripts can set the value of any field, including changing the range of
choices in an option list. This is particularly useful when these options
depend on the values of other fields. You can also define calculated fields
whose values are updated automatically when dependent fields are altered.
Field Attributes
Text fields, radio buttons and checkboxes can be flagged as being:
- In Error
- Temporarily disabled (greyed out)
- Okay (the default)
Option lists can be flagged as being in error and individual choices
may be temporarily disabled.
Status Messages
Scripts often have a need to display a status message. The HTML 3 DTD
will be extended to support named status fields which can be set by
scripts. The messages can be displayed at one of three levels:
Responding to Events
Scripts allow authors to catch and respond to the following kinds of
events:
- Clicking on radio buttons and checkboxes
- Gaining and losing the focus (text fields)
- Key presses for the field with the focus
- Entering/leaving the document
Reading Certain Properties
For example the user's name, the time of day, and characteristics
of the browser, e.g. window size, font metrics, ...