Validation and forms
About this lesson: Validation and forms
In short
Validation checks each entry against a rule when it is typed, before it is saved. A range check only accepts values between limits: here, ages 8 to 16. Change the age.

What you'll explore
- Range check: Between the limits
- Validation checks each entry against a rule when it is typed, before it is saved.
- Length check: Not too short, not too long
- A length check counts the characters. Usernames here must be 4 to 12 characters. Try each username.
- Presence and format: Not blank, right pattern
- A presence check stops a field being left empty. A format check makes sure data follows a pattern, like name@place.domain for an email.
- Form design: Help people enter good data
- A good form has clear labels, hints and the right controls, such as drop-down lists and date pickers, so mistakes are less likely.
- Check yourself: Which check?
- A form must reject a test score of 130 when scores can only be 0 to 100.
Also in this lesson
- Common mix-ups
- Five common checks
- Validation and verification
- Form critic
Words to know
- validation
- Automatic checks that entered data is sensible.
- presence check
- Makes sure a field isn't left empty.
- range check
- Makes sure a value is between limits.
- length check
- Checks the number of characters.
- format check
- Checks data follows a pattern.
- verification
- Checking data was entered correctly.
Sources
- BBC Bitesize GCSE Computer Science: Validation and verification