We use return false; because when this function is called when the form is submitted and if this textbox is found empty the page shouldn’t be submitted so returning the boolean value false with prevent the form from being submitted.
Forms allow users to submit data in many different ways.
A range of form input elements are available including text boxes, checkboxes, radio buttons, and submit buttons.
The first example shows how to validate a checkbox if nothing is checked.
This is similar to radiobutton example explained above.
Here is the code used for the radio button themselves.
The creation of multiple groups of radio buttons for the one form is also straightforward.
In actual fact the setup of these fields is the most simple of all form fields to validate as radio buttons set one value that only needs to be tested when the form is submitted.
The difficulty with radio buttons is that there are at least two and usually more fields that need to be placed on the form, related together and tested as one group.
Provided that you use the correct naming conventions and layout for your buttons, you will not have any trouble.