Validating text boxes in javascript

Give this a shot and let me know if it helps or if you have any questions.of course you can write additional custom methods to validate numbers only, email address, valid URL, etc.Here is the js that I have written, but it only returns true if all 10 textboxes are filled, rather than just checking if one is filled.I must confess that I 'learned' j Query first (the similarity with CSS-selection was its attraction), but I am now moving towards preferring 'plain' Java Script, now.

It can prevent people from leaving fields blank, from entering too little or too much or from using invalid characters.

Now i require that when submit button is clicked, each text boxes should be validated whether it is empty or not on client side.

The entered values in the text box should not disappear and number of empty text boxes should be same. Validation of text boxes client side or server side?

In other words if the first condition fails, the second condition will not be tested and so forth.

Only when all conditions have been satisfied do we reach the command, in which case the form will be submitted.


Leave a Reply