Key components in HTML form
HTML Forms: A web form or HTML form on a web page that allows users to enter data that is then sent to a server for processing. Forms may resemble database forms because website users fill out the forms using:
- Input fields
- Select menus
- Check-boxes
- Radio buttons
- Text-area
- Submit button
- Reset button
In this article, we are going to thoroughly discuss the key form elements.
- Input field:
The
<input>tag specifies an input field where the user can enter data. The<input>element is the most important form element – it can be displayed in several ways, depending on the type attribute.
- Select menus/Select drop-down: The
<select>element is used to create a drop-down list – it is most often used in forms to collect user input. The<option>tags inside the<select>element define the available options in the drop-down list.
- Check-boxes: The
check-boxis a square box that is ticked (checked) when activated. Checkboxes let users select one or more options from a limited number of choices.
- Radio-buttons: The
radio buttonis a form element that allows the user to select one option from a range of options. Radio elements are created with the HTML<input>tag. Radio buttons can be nested inside a<form>element or they can stand alone.
- Text-area: The
<textarea>tag defines a multi-line text input control. Atextareacan hold an unlimited number of characters, and the text renders in a fixed-width font. The size of thetextareais specified by the<cols>and<rows>attributes.
-
Submit button: The
submit buttonsubmits all form values to a form-handler. The form-handler is typically a server page with a script for processing input data. -
Reset button: The
reset buttonresets all form values to their initial values.