<html> var numericExpression = /^[0-9]+$/;
<head><title>Registration Form if([Link](numericExpression)){
Validation</title></head> return true;
<body bgcolor="#E4F0F8"> }else{
<script type='text/javascript'> alert(helperMsg);
function formValidator() [Link]();
{ return false;
// Make quick references to our fields }
var firstname = }
[Link]('firstname'); function isAlphabet(elem, helperMsg){
var lastname = var alphaExp = /^[a-zA-Z]+$/;
[Link]('lastname'); if([Link](alphaExp)){
var email = return true;
[Link]('email'); }else{
var pass = [Link]('pass'); }
var addr = [Link]('addr'); }
var mobileno = alert(helperMsg);
[Link]('mobileno'); [Link]();
// Check each input in the order that it return false;
appears in the form! function isAlphanumeric(elem, helperMsg){
if(notEmpty(firstname, "can not be null")){ var alphaExp = /^[0-9a-zA-Z]+$/;
if(isAlphabet(firstname, "Please enter only if([Link](alphaExp)){
letters for your Firstname")){ return true;
if(lengthRestriction(firstname, 6)){ }else{
if(isAlphabet(lastname, "Please enter only }
letters for your Lastname")){ }
if(emailValidator(email, "Please enter a valid alert(helperMsg);
email address")){ [Link]();
if(lengthRestriction(pass, 6)){ return false;
if(isAlphanumeric(pass, "please enter function lengthRestriction(elem, min){
Numbers and Letters Only for password")){ var uInput = [Link];
if(notEmpty(addr, "please enter the if([Link] >= min){
address")){ return true;
if(isNumeric(mobileno, "Please enter a valid }else{
mobileno")){ }
if(lengthRestriction1(mobileno, 10 , 10)){ }
return true; alert("Please enter minimum " +min+ "
}}}} characters");
} [Link]();
} return false;
} }
}}} }
return false; function emailValidator(elem, helperMsg)
} {
function notEmpty(elem, helperMsg) var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]
{ +\.[a-zA-z0-9]{2,4}$/;
if([Link] == 0){ if([Link](emailExp))
alert(helperMsg); {
[Link](); // set the focus to this input }
return false; else{
} }
return true; }
} return true;
function isNumeric(elem, helperMsg){ alert(helperMsg);
[Link](); </form>
return false; </body>
function lengthRestriction1(elem, min, max) </html>
{
var uInput = [Link];
if([Link] >= min && [Link] <=
max)
{
}
else {
}
}
return true;
alert("Please enter 10 numbers only");
[Link]();
return false;
</script>
<center><font color="blue" size="6"
face="arial">Registration
Form</font></center><br />
<form onsubmit='return formValidator()'
action="[Link]">
First Name(Minimum 6 characters)<font
color="red">* </font>
<input type='text' id='firstname' /><br
/><br />
Last Name<font color="red"><font
color="red">* </font> </font>
<input type='text' id='lastname' /><br
/><br />
Email Address<font color="red">* </font>
<input type='text' id='email' /><br />
<font color="red">(one e-mail id only):</font>
<font color="redblue">e.g.
smith@[Link]</font><br /><br/>
Password(minimum 6 characters)<font
color="red">* </font>
<input type='password' id='pass'><br /><br/>
Address<font color="red">* </font>
<textarea rows="2" cols="20" id='addr'
/></textarea> <br /> <br/>
Mobile No<font color="red">* </font>
<input type='text' id='mobileno' /><br />
Gender: <input type='radio'
name="gender">male
<input type='radio'
name="gender">female<br/><br />
<input type='Submit' value='submit' />
<input type='Reset' value='reset' />