The input element contains the largest numbers of possible form control types there are.
Which control type is going to be used is declared by the attribute type.
The options to choose from are:
Creates a single line text field. It is usually used for personal names, country names etc...
Essentially same as text but the characters get masked with, i.e., series of asterisks in place of really typed text. This is protection only against somebody looking directly at it while being typed. The actual value sent to the server is the current (real) text a user typed in and therefore better means of protection will be necessary to fully protect the sensitive input.
On/off toggle inputs are being created and user can select none, one or more of then at the same time. Only selected checkboxes are being sent to the server. There is a possibility of having one or more boxes pre-checked with the attribute check.
Radio type creates radio buttons. They are same as checkboxes except that they share the same name attribute which makes them mutually exclusive or in other words only one in a group can be selected. The browser must ensure that the first radio button gets transmitted as "on", in case of not having any of them selected before submitting. Same as checkboxes they have a possibility of having one of them pre-checked.
Submit buttons are used to submit the form automatically. A form may have more then one submit button.
Image control type basically creates a graphical submit button. After a click on it the form will also automatically get submitted but this time the server will receive the click coordinates in pixels measured from left-top of the image. The src attributes defines the URI for the image.
Resets the form to its initial values. Not needed very often.
This input type control will not be visible to client side users directly from a browser so it is often used for storing information between server and client exchanges. IT IS NOT SAFE to store sensitive data into a hidden field. That is because browsers have "see source" options that will present the data stored inside even if the user initially is not able to see it.
Gives an option to the users to upload and send some files and its contents to the server. The size is limited by the servers default parameters which are, unless modified by the hosting company, as low as 2MB per upload (Apache server).
Input is an empty element, therefore the closing tag is forbidden.
<input type="" name="" />
- id, class (document-wide identifiers)
- lang (language information), dir (text direction)
- title (element title)
- style (inline style information)
- alt (alternate text)
- name (elements name)
- type (input element control type)
- value (initial and sent to server values)
- size, maxlength (field proportions limitations)
- checked (checkbox and radio buttons pre-checked options)
- src (file or image type URI source)
- accept (legal content types for a server)
- readonly (read-only input controls)
- disabled (disabled input controls)
- tabindex (tabbing navigation)
- accesskey (access keys)
- usemap (client-side image maps)
- ismap (server-side image maps)
- onfocus, onblur, onselect, onchange, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup (intrinsic events)
HTML input element: