Web Development and Design Foundations with XHTML, 5th Edition

(Steven Felgate) #1

(^598) Appendix A XHTML Reference


A.15 Form Element Tags


The <input />Ta g
<input />
The stand-alone <input />tag configures an input element for a form. The attributes
and their values determine the type of input element displayed on the Web page. Table
A.25 shows <input />tag attributes and their values.

Table A.24

tag attributes


Attribute Value Usage
action File name or URL of the program or script that
will handle the form data

Specifies the name of the server-side program or
script that will handle the form data.
id Alphanumeric, no spaces; the value must be
unique and not used for other idvalues.

Provides a unique identifier for the form.

method "post" Preferred by the W3C. Sends the form data to the
Web server as a part of the entity body of the HTTP
response. Form data is not visible in the URL.
"get"(default) Sends the form data to the Web server as part of
the URL.
enctype "multipart/form-data" Specifies that the form will accept a file as input
(using an <input type="file" />element).
name Text name, beginning with a letter, no spaces This attribute is optional. It names the form so that
it can be easily accessed by client-side scripting
languages such as JavaScript to edit and verify the
form information before the server-side processing
is invoked. This attribute is deprecated in XHTML
but is used to provide backward compatibility with
browsers that support HTML.
target See Table A.13 Specifies the window used to display the form
response. The default is the current window. See
Table A.13.

Table A.25tag attributes


Attribute Value Usage
type "text", "checkbox", "radio", -
"hidden", "submit", "reset",
"button", "image",
"password","file"

Configures a specific form element (required).

accesskey A character on the keyboard Configures a hot key that immediately places the cursor on the
form element.
checked "checked" Used with type="checkbox" or type="radio".
Indicates that the form element is selected.
disabled "disabled" Prevents the cursor from being placed in the form element.
Free download pdf