Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

validation for string(CHAR DATATYPE)

Status
Not open for further replies.

nagusatya

Programmer
Jun 3, 2005
9
0
0
GB
hi all,
i am having a string whose datatype is CHAR in the database and length is 7 .
can any one help me with the javascript validation code(function) for this?

regards and thanks in advance
 
How about this? I don't know...
[tt]
function nbyte(s) {
var t;
var c=s.length;
for (var i=0;i<s.length;i++) {
t=s.charCodeAt(i);
while ((t&255)!=t) { c++; t=(t>>8);}
}
return (c);
}
[/tt]
And validate the rs field rs("charfield") like this.
[tt]
return (nbyte(rs("charfield"))==7)?true:false;
[/tt]
- tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top