Account No. Validation.

Can anyone give me how to validate a bank account no. by ur own example.Take any bank as example(whatever) u had vaidated n tell me 1)rules given by that particular bank.2)n how u had validated it.
[225 byte] By [nrkbab1a] at [2007-10-3 8:35:04]
# 1

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

mssuhaila at 2007-7-15 3:42:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Can you elaborate more on what kind of validation you want.Javascript regular expression can do wonders for you.But if thats a banking app. then go also for server-side validation.Don't count on JS for financial apps.
mrjavaa at 2007-7-15 3:42:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Can u plz explain me by means of an example(Thatz plz take an account no.). Validate it both by means of Js Regular Expressions n server side validations.
nrkbab1a at 2007-7-15 3:42:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

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

mrjavaa at 2007-7-15 3:42:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
TnQ. I understood.
nrkbab1a at 2007-7-15 3:42:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
Little correctionvar myReg = RegExp("^[0-9]{6}$");//this allows the account number of length 6
mrjavaa at 2007-7-15 3:42:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
10Q
nrkbab1a at 2007-7-15 3:42:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...