The demo below , uses a function to check if value in the form field is empty or null.
A simple six digit zipcode can be checked using regular expression which matches exactly six digits : /^d$/ Another way can be /^[0-9][0-9][0-9][0-9][0-9][0-9]$/ , for zipcode with dash in between it can be /^\d-? There may be some form fields whose values must be strictly alphabetic characters, eg: Name, Country, State.
Server-side validation incorporates code validation into a form handler. NET application on the server that provides the functionality that your form needs for processing after a customer has submitted it.
Because the code is stored on the server, server-side validation requires a roundtrip to the server.
This code validates a 10 digit phone number taken in any format and sets the phone number text field to the desired output format.
The idea behind this code is to make it as simple as possible for the user to correctly enter their phone number in the correct format.
Note Front Page Server Extensions are a set of programs that provide access to special Front Page features, such as database processing, form processing, hit counters, and other built-in Front Page components that require server-side processing.
You can provide custom validation for your forms in two ways: server-side validation and client-side validation.
Client side validation is performed by a web browser, before input is sent to a web server.
In the below demo the regular expression looks for one or more uppercase or lowercase letters within the character class [A-Za-z], followed with an end of a line anchor $ Some undesired spaces and dashes from the user input can be removed by using the string object replace() method.
The regular expression is used to find the characters and then replace them with empty spaces.
To improve usability, we could call this function from the phone number input field's onblur() event.
This way after the user tabbed away from the textbox, their number would automatically be formatted.