HTML and CSS Reference
In-Depth Information
accept-charset CDATA #IMPLIED
>
This example associates seven attributes with the
form
element. The
ac-
tion
attribute is required and accepts a character string value. The
meth-
od
attribute has one of two values, either
get
or
post
.
get
is the default,
so if the document author doesn't include the
method
attribute in the
form
tag, the XML parser assumes
method=get
automatically.
The
enctype
attribute for the
form
element accepts a character string
value and, if not specified, defaults to a value of
application/x-www-form-
urlencoded
. The remaining attributes all accept character strings, are not
required, and have no default values if they are not specified.
If you look at the attribute list for the
form
element in the HTML DTD,
you'll see that it does not exactly match our example. That's because
we've modified our example to show the types of the attributes after any
parameter entities have been expanded. In the actual HTML DTD, the
attribute types are provided as parameter entities whose names give a
hint of the kinds of values the attribute expects. For example, the type
of the
action
attribute appears as
%URI;
, not
CDATA
, but elsewhere in the
DTD is defined to be
CDATA
. By using this style, the DTD author lets you
know that the string value for this attribute should be a URL, not just
any old string. Similarly, the type of the
onsubmit
and
onreset
attributes
is given as
%Script
. This is a hint that the character string value should
name a script to be executed when the form is submitted or reset.