If the required field is blank, we return the error string to the main function.If its not blank, the function returns an empty string.
In this article we will discuss about regular expression for validating Phone number in various format.
In the following example user enters a phone number.
Next, we use the is Na N() function to check if the phone number contain only numbers.
At last we check the length of the string and permit only phone numbers with 10 digits. When the user clicks the Submit button on the form, the form data is sent to a Java Script validation function that checks each field to make sure that it is in the appropriate format.
Otherwise it returns a message describing the error and highlight appropriate element with yellow.
validate Empty ( ) The function below checks if a required field has been left empty.
Next, we use the Java Script regular expression /\W/ to forbid illegal characters from appearing in usernames.
We want to allow only letters, numbers and underscopes.
Any interactive web site has form input - a place where the users input different kind of information.
This data is passed to ASP script, or some other technology and if the data contains an error, there will be a delay before the information travels over the Internet to the server, is examined on the server, and then returns to the user along with an error message.