<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Example</title> <sc"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Example</title> <sc">

Pan Card, MICR, IFSC code Validation Example In JavaScript

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>New Example</title>
<script>
function Validation()
{
	//party code
	a=document.getElementsByName("partycode").item(0).value;
var valid=/^[a-zA-Z0-9_]*$/;
if(a.trim().length==0)
{
	alert("party code must be filled out");
	return false;
}
if(!valid.exec(a))
{
alert("only alphanumeric allowed");
return false;
}

//party Name 
	a=document.getElementsByName("partyname").item(0).value;
var valid=/^[a-zA-Z_ ]*$/;
if(a.trim().length==0)
{
	alert("party name must be filled out");
	return false;
}

if(!valid.exec(a))
{
alert("only alpha allowed");
return false;
}


//pan number 
	a=document.getElementsByName("panno").item(0).value;
var valid=/^[a-zA-Z]{5}[0-9]{4}[a-zA-Z]$/;
if(a.trim().length==0)
{
	alert("pan number must be filled out");
	return false;
}

if(!valid.exec(a))
{
alert("ABCDE1234F");
return false;
}


//ifsc code 
	a=document.getElementsByName("ifcscode").item(0).value;
var valid=/^[a-zA-Z]{4}[0-9]{7}$/;
if(a.trim().length==0)
{
	alert("ifsc must be filled out");
	return false;
}

if(!valid.exec(a))
{
alert("NNSB0128051");
return false;
}


}
</script>
<style>
label,input[type="text"]
{
	display:inline-block;
	width:150px;
}

</style>
</head>
<body>
<form name="myForm" method="post" action="" onsubmit="return Validation()">
<div><label>Party code</label>
<input type="text" name="partycode" required="required"></div>
<div><label>Party Name</label>
<input type="text" name="partyname" required="required"></div>
<div><label>PAN No</label>
<input type="text" name="panno" required="required"></div>
<div><label>Bank Account title</label>
<input type="text" name="bankaccounttitle" required="required"></div>
<div><label>Bank Name</label>
<input type="text" name="bankname" required="required"></div>
<div><label>IFCS Code</label>
<input type="text" name="ifcscode" required="required"></div>
<div><label>MICR no</label>
<input type="text" name="micrno" required="required"></div>
<div><button type="submit" name="submit">Kindly Attached a cancel cheque</button></div>
</form>
</body>
</html>


Leave a Reply