A webform, web form or HTML form on a web page allows a user to enter data that is sent to a server for processing. Forms can resemble paper or database forms because web users fill out the forms using checkboxes, radio buttons, or text fields. For example, forms can be used to enter shipping or credit card data to order a product, or can be used to retrieve search results from a search engine.
Forms are enclosed in the HTML form
tag. This tag specifies the communication endpoint the data entered into the form should be submitted to, and the method of submitting the data, GET or POST.
Forms can be made up of standard graphical user interface elements:
The sample image on the right shows most of these elements:
These basic elements provide most common graphical user interface (GUI) elements, but not all. For example, there are no equivalents to a tree view or grid view.
A grid view, however, can be mimicked by using a standard HTML table with each cell containing a text input element. A tree view could also be mimicked through nested tables or, more semantically appropriately, nested lists. In both cases, a server-side process is responsible for processing the information, while JavaScript handles the user-interaction. Implementations of these interface elements are available through JavaScript libraries such as jQuery.
HTML 4 introduced the label
tag, which is intended to represent a caption in a user interface, and can be associated with a specific form control by specifying the id
attribute of the control in the label tag's for
attribute. This allows labels to stay with their elements when a window is resized and to allow more desktop-like functionality e.g. clicking a radio button or checkbox's label will activate the associated input element.