Web programming

Units WEB1P and WEB2P

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.

  1. Use the code for the Select ‘n’ Go example and amend the menu to show the units on your course.
  2. 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.
  3. 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.
    1. Validate the e-mail field using an appropriate regular expression
    2. Validate the Postcode using an appropriate regular expression for UK postcodes
    3. Validate the telephone number field using an appropriate regular expression for UK numbers
    4. Check that the radio buttons are checked
    5. 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.
 

Last updated by Prof Jim Briggs of the School of Computing at the University of Portsmouth

 
The web programming units include some material that was formerly part of the WPRMP, WECPP, WPSSM and WEMAM units.