Tuesday, September 7, 2010

HTML form and input elements

HTML from

The Form element is used to delimit a data input form. There can be several forms in a single document, but the Form element cannot be nested. (i.e. a form cannot contain another form)

The ACTION attribute is a URL specifying the location to which the contents of the form data fields are submitted to elicit a response. As mentioned before, this could be simply a direction to an e-mail address, but generally, would be used to point towards some kind of server based CGI script/application that handles the forwarding of form data. If the ACTION attribute is missing, the URL of the document itself is assumed. The way data is submitted varies with the access protocol of the URL to which the form data is sent and with the values of the METHOD and ENCTYPE attributes.
Generally, the METHOD attribute specifies a method of accessing the URL specified in the ACTION attribute and will be either GET or POST. The GET method is ideal for form submission where the use of the form data does not require external processing. For example, with database searches, there is no lasting effect caused by the query of the form (that is, the query runs its search through the database and reports the results). However, where the form is used to provide information for example, that updates a database, then the POST method should be used, with the ACTION attribute pointing to a CGI script that executes the form data processing.
The ENCTYPE specifies the media type used to encode the form data. The default ENCTYPE is the MIME type 'application/x-www-form-urlencoded'
The
element can also accept the TARGET attribute (as in elements), to specify what window is used for any form feedback. It can take the following values : can also take the NAME attribute, which can be used to set the name of the element for scripting purposes.

Input elements

ALIGN
Vertical alignment of the image. For use only with TYPE=IMAGE in HTML level 2. The possible values are exactly the same as for the ALIGN attribute of the element.

CHECKED
Indicates that a checkbox or radio button is selected. Unselected checkboxes and radio buttons do not return name/value pairs when the form is submitted.

MAXLENGTH
Indicates the maximum number of characters that can be entered into a text field. This can be greater than specified by the SIZE attribute, in which case the field will scroll appropriately. The default number of characters is unlimited.

NAME
Symbolic name used when transferring the form's contents. The NAME attribute is required for most input types and is normally used to provide a unique identifier for a field, or for a logically related group of fields. The name given to the element can also be used to reference it for scripting purposes.

SIZE
Specifies the size or precision of the field according to its type. For example, to specify a field with a visible width of 24 characters:
INPUT TYPE="text" SIZE="24"

SRC
To be used with the TYPE=IMAGE , this attribute represents a URL specifying an the desired image.

TEXT: is used for a single line text entry fields. It should be used in conjunction with the SIZE and MAXLENGTH attributes to set the maximum amount of text that can be entered. For textual input that requires multiple lines, the

No comments:

Post a Comment