Revision Chapter 10 (Computer)
Revision Chapter 10 (Computer)
Creating a form:
In HTML, a “form” is a section of a webpage that allows users
to input data through various interactive elements like text
fields, checkboxes, radio buttons, and dropdown menus,
which can then be submitted to a server for processing;
essentially, it’s a way to collect user information on a
website, like a digital questionnaire, using the <form> tag
and various input elements within it.
Adding Checkbox:
The <input type=”checkbox”> defines a checkbox. The
checkbox is shown as a square box that is ticked (checked)
when activated. Checkboxes are used to let a user select
one or more options of a limited number of choices. Tip:
Always add the <label> tag for best accessibility practices!
Adding a radio control:
Use the <input type=”radio”> element within <form> tags,
ensuring each radio button has the same name attribute to
group them together. Getting the Selected Radio Button
Value: Access the value property of the selected radio
button to retrieve the chosen option.
Adding buttons:
The most commonly used buttons are Submit and Reset.
They are used when we have entered all the details in the
form.
Submit: When we click on this button, then the data which is
entered in the fields will be sent to server as a series of name
and value pairs. The “Name” being the name of the form and
the value is the input value entered by the user in the field.
Reset: The Reset button is used to clear the contents and set
the values of all the form elements to their initial state and
activate them.