The following is Numeric(String) function checks the given mobile number is having only numeric values.If the field has other than 0-9, then it will return false. [a-z] : It matches characters from lowercase ‘a’ to lowercase ‘z’. If by mistake, user skips entering any detail, soon the alert message appear on the form. escaping - by -) [0-9] : It matches digital number from 0-9. That means, you could be very sure about the form, whether users have entered the details or not.To check, whether the user entered correct form of data, it’s must to apply form validation in any of the form. The expression is: /^[a-z A-Z] $/ The above expression checks whether the input characters in the string is alphabet or not.Here I am giving you the form validation codes in Java Script. These are simple meta characters which do pattern matching. If the entered characters in the field is not in lower case or upper case. When it’s about checking contact field or zip code field, one need to check whether only the number have been entered or not.
If the string value is numeric, it will return true, otherwise it will return false.
function form Validation() // Function that checks whether input text is numeric or not.
function text Numeric(inputtext, alert Msg) // Function that checks whether input text is an alphabetic character or not.
In this example, let us check whether given mobile number is valid or not.
That means we have to ensure, the mobile number field should have only digits (0-9) and it has length of 10.