HTML Tutorial – 14 – Forms II


The most useful and common input type is the
text field. Like most form elements it requires the name attribute to be specified and the
value attribute will be set to the text that it contains.
Another useful input type is the password field, which hides its characters from view.
For both of these types we can specify an initial value using the value attribute.
We can also change the field’s size, which is measured in number of character, or put
a character limit on the field using the maxlength attribute.
The last text field – hidden – is used to add data to a form without displaying it to
the user. Because the user can’t change this input type’s value we must specify it in the
markup. Next, we have checkboxes which are used to
give multiple choices. If we don’t specify a value a selected checkbox is sent with the
value “TRUE”. And if the box is unchecked no value will be sent for this element.
With radio buttons only one button in every group can be checked. To group radio buttons
together we just need to give them the same name. We can also make default selections
using the checked attribute.

Add a Comment

Your email address will not be published. Required fields are marked *