Practical JS3
Form validation
Examples of form validation:
When you have completed this tutorial please spend your time experimenting with
developing further scripts using the techniques you have learnt to date.
- Use the code for the Select
‘n’ Go example and amend the menu to show the units on your
course.
- By using the Select ‘n’ Go method create a navigation bar along
the top of the page. Include the option of a go button for those users that
don’t run JavaScript.
- Develop a form in HTML that asks for Name (firstname and surname), Address
(House Number, Street, City, and Postcode), E-mail contact, Telephone number,
course name, all as text input fields. Implement the course level field as
radio buttons.
- Validate the e-mail field using an appropriate regular expression
- Validate the Postcode using an appropriate regular expression for UK
postcodes
- Validate the telephone number field using an appropriate regular expression
for UK numbers
- Check that the radio buttons are checked
- In the name field, check that the first letter of the firstname and
surname are in capitals. If they are not then amend the field content.