Javascript code for validating textbox

[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.

set validation group property for all validators, summary and button.

when you click the button , it will validate all validators from its validation group and display the message.

This would apply an error css class to highlight your required fields and display an appropriate message to the user.

With a little work you could easily turn this into a j Query helper method that you could reuse in all sorts of situations.

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.

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.

By combining the expression for numbers and alphabetic characters, there is an expression that checks, whether the entered things includes numbers and alphabetic character or not.

Tags: , ,