store the acc no as string.
Its code come like this:
first four digit depicts the branch code
next two, the type of account(savings, current etc.)
last six the actual ac no.
You can use string length method and sub string methods in java/javascript to validate it.
Better go for javascript
function validation(){
var myReg = RegExp("^[0-9]{0,6}$");//this allows the account number of length 6
var m = myReg.exec(document.<formname>.<fieldname>);
//example:
//var m =myReg.exec(document.transaction.accountno);
if(m==null) {
alert("Invalid Account");
document.<formname>.<fieldname>.focus();
return false;
}
}
Serverside validation:
You can use java's regex feature or check the String class methods.
Hope you understand