Validation Form
A program in Java Script to demonstrate general validation using regular expression in Java Script. Validation is an important part while building a website or general page since it helps us validating the entered data from the users and reporting any errors. This helps us gathering proper data rather than garbage. Now validation can be done in different methods or at different stages but it here are few simple ones. In this example program below the validation rules for: Name - should start with a capital letter and can have any number of words but should start with capitals. RollNo - It should have a basic number as "12103158" in the start and can have number ranging from 1 to 68. Program: The screen shot of the html program function nameVal() { nm=document.getElementById("un").value; if(nm.search(/^[A-Z][a-z]+( [A-Z][a-z]+)*$/)==0) alert("valid name"); else alert("invalid name"); } function rollVal() { r=docu