Professional Documents
Culture Documents
uk
Form Validation
Web Pages: Behaviour
CSC1014
Forms: Validation
Basic form operation is limited
"...press submit, collect 'successful' data, send to server..."
Validation can take place at the server But server validation requires
Allows request information to be checked (referrers etc) Extra round trip via HTTP Maintaining of state during submit > check > resubmit
JISC Netskills
CSC1014
Can be used to check completeness, format, type, value etc. If validation succeeds then HTTP submission occurs If validation fails then HTTP request is never made and control drops back to the user
JISC Netskills
CSC1014
JISC Netskills
CSC1014
Best practice to provide one set of feedback Usually better to validate whole form
Rather than per control (e.g. via onfocus/onblur etc)
JISC Netskills
CSC1014
More powerful to accurately match patterns in the input Unless specifically looking for a fixed string/number you'll need to enter the world of...
Regular Expressions!
JISC Netskills