Experiment #04 Form Validation
Instructions
Special Notes:
Please remember that the following JavaScript functions can be done by using HTML5 as well
but the functions in HTML5 are not faultless therefore still JavaScript are used proper
validations.
Form validation
When a user enters data to a form and submits it we can use JavaScript to validate these data
before sending it the server for further processing.
JavaScript can be used to check whether;
• A text field is empty
• User has entered numbers when string is expected and vice versa
• Email address is valid etc…
In validating html 5 forms there are several ways of retrieving the values from the html page.
• To get the data by the element by ID
• To get the data by the DOM object
Experiment:
Step 1 – Create the following form