Form Tags in HTML


Forms - Forms create an interface for the user to select options and submit data back to the web server.

TagAttributeDescription
BUTTONcore, eventsCreates a button
 name="..."The name of the button
 value="..."The button value
 type="..."The type of the button (button, submit, reset)
 disabled="..."Sets the button state to disabled
 tabindex="..."Sets the tabbing order between elements with a defined tabindex
 onfocus="..."The event which occurs when the button receives focus
 onblur="..."The event that occurs when the button loses focus
FIELDSETcore, eventsGroups related controls
FORM Creates a form which holds controls for user input
 action="..."The URL for the server action
 method="..."The HTTP method (get, post)
 enctype="..."Specifies the MIME (internet media type)
 onsubmit="..."This event occurs when the form is submitted (posted)
 onreset="..."This event occurs when the form is reset (cleared)
 target="..."Determines where the resource will be displayed (user-defined name, blank, parent, self, top)
 accept-charset="..."The list of character encodings
INPUTcore, eventsDefines controls used in forms
 type="..."The type of input control (text, password, checkbox, radio, submit, reset, file, hidden, image, button)
 name="..."The control name (required except for submit and reset)
 value="..."The initial value of the control (required for radio and checkboxes)
 checked="..."Sets the radio buttons to a checked state
 disabled="..."Disables the control
 readonly="..."For text password types
 size="..."The width of the control in pixels except for text and password controls, which are specified in numbers of characters
 maxlength="..."The maximum number of characters which can be entered
 src="..."The URL to an image control type
 alt="..."An alternative text description
 usemap="..."The URL to a client-side image map
 align="..."Controls alignment (left, center, right, justify)
 tabindex="..."Sets the tabbing order between elements with a defined tabindex
 onfocus="..."The event which occurs when the element receives focus
 onblur="..."The event which occurs when the event loses focus
 onselect="..."The event that occurs when the control is selected (for a text element when text is highlighted)
 onchange="..."The event that occurs when the control is changed
 accept="..."File types allowed for upload
ISINDEXcorePrompts the user for input
 prompt="..."Provides a prompt string for the input field
LABELcore, eventsLabels a control
 for="..."Associates a label with an identified control
 disabled="..."Disables a control
 accesskey="..."Assigns a hotkey to this element
 onfocus="..."The event which occurs when the element receives focus
 onblur="..."The event which occurs when the event loses focus
LEGENDcore, eventsAssigns a caption to a FIELDSET
 align="..."Controls alignment (left, center, right, justify)
 accesskey="..."Assigns a hotkey to this element
OPTGROUPcore, eventsUsed to group elements within a SELECT tag
 disabledNot used
 label="..."Defines a group label
OPTIONcore, eventsSpecifies choices in a SELECT tag
 selected="..."Specifies if the option is selected or not
 disabled="..."Disables the control
 value="..."The value submitted if a control is submitted
SELECTcore, eventsCreates choices for the user to select
 name="..."The name of the element
 size="..."The width in number of rows
 multipleAllows multiple selections
 disabled="..."Disables the control
 tabindex="..."Sets the tabbing order between elements with a defined tabindex
 onfocus="..."The event which occurs when the element receives focus
 onblur="..."The event which occurs when the event loses focus
 onselect="..."The event that occurs when the control is selected (for a text element when text is highlighted)
 onchange="..."The event that occurs when the control is changed
TEXTAREAcore, eventsCreates an area for user input with multiple lines
 name="..."The name of the control
 rows="..."The width in number of rows
 cols="..."The height in number of columns
 disabled="..."Disables the control
 readonly="..."Sets the displayed text to read-only status
 tabindex="..."Sets the tabbing order between elements with a defined tabindex
 onfocus="..."The event which occurs when the element receives focus
 onblur="..."The event which occurs when the event loses focus
 onselect="..."The event that occurs when the control is selected (for a text element when text is highlighted)
 onchange="..."The event that occurs when the control is changed