[ Pobierz całość w formacie PDF ]
subsections on form display issues [p.347] .
17.2 Controls
Users interact with forms through named controls.
A control s "control name" is given by its name attribute. The scope of the name
attribute for a control within a FORM element is the FORM element.
Each control has both an initial value and a current value, both of which are
character strings. Please consult the definition of each control for information about
initial values and possible constraints on values imposed by the control. In general, a
control s "initial value" may be specified with the control element s value attribute.
However, the initial value of a TEXTAREA element is given by its contents, and the
initial value of an OBJECT element in a form is determined by the object
implementation (i.e., it lies outside the scope of this specification).
The control s "current value" is first set to the initial value. Thereafter, the control s
current value may be modified through user interaction and scripts. [p.251]
A control s initial value does not change. Thus, when a form is reset, each
control s current value is reset to its initial value. If a control does not have an initial
value, the effect of a form reset on that control is undefined.
When a form is submitted for processing, some controls have their name paired
with their current value and these pairs are submitted [p.245] with the form. Those
controls for which name/value pairs are submitted are called successful controls
[p.245] .
24 Dec 1999 18:26 220
Forms in HTML documents
17.2.1 Control types
HTML defines the following control types:
buttons
Authors may create three types of buttons:
submit buttons: When activated, a submit button submits a form. [p.245] A
form may contain more than one submit button.
reset buttons: When activated, a reset button resets all controls to their
initial values. [p.220]
push buttons: Push buttons have no default behavior. Each push button
may have client-side scripts [p.251] associated with the element s event
[p.254] attributes. When an event occurs (e.g., the user presses the button,
releases it, etc.), the associated script is triggered.
Authors should specify the scripting language of a push button script
through a default script declaration [p.253] (with the META element).
Authors create buttons with the BUTTON element or the INPUT element.
Please consult the definitions of these elements for details about specifying
different button types.
Note. Authors should note that the BUTTON element offers richer rendering
capabilities than the INPUT element.
checkboxes
Checkboxes (and radio buttons) are on/off switches that may be toggled by the
user. A switch is "on" when the control element s checked attribute is set.
When a form is submitted, only "on" checkbox controls can become successful
[p.245] .
Several checkboxes in a form may share the same control name. [p.220]
Thus, for example, checkboxes allow users to select several values for the
same property. The INPUT element is used to create a checkbox control.
radio buttons
Radio buttons are like checkboxes except that when several share the same
control name [p.220] , they are mutually exclusive: when one is switched "on",
all others with the same name are switched "off". The INPUT element is used to
create a radio button control.
If no radio button in a set sharing the same control name is initially "on", user
agent behavior for choosing which control is initially "on" is undefined. Note.
Since existing implementations handle this case differently, the current
specification differs from RFC 1866 ([RFC1866] [p.356] section 8.1.2.4), which
states:
At all times, exactly one of the radio buttons in a set is checked. If none of
the elements of a set of radio buttons specifies CHECKED , then
the user agent must check the first radio button of the set initially.
221 24 Dec 1999 18:26
Forms in HTML documents
Since user agent behavior differs, authors should ensure that in each set of
radio buttons that one is initially "on".
menus
Menus offer users options from which to choose. The SELECT element creates
a menu, in combination with the OPTGROUP and OPTION elements.
text input
Authors may create two types of controls that allow users to input text. The
INPUT element creates a single-line input control and the TEXTAREA element
creates a multi-line input control. In both cases, the input text becomes the
control s current value [p.220] .
file select
[ Pobierz całość w formacie PDF ]