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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validate text box Character Length 1

Status
Not open for further replies.

schase

Technical User
Sep 7, 2001
1,756
US
Hi all,

Was looking to validate exactly 17 characters (letters or numbers) - preferrably when the cursor goes off of the field and onto another one.

Any ideas?

Thank you
"Damn the torpedoes, full speed ahead!"

-Adm. James Farragut

Stuart
 
<html>
<head>
<script>
function CheckLen(txt)
{
if (txt.length<17) {
alert(&quot;Please enter a minimum of 17 characters&quot;);
document.frm.txtBox.focus()
}
}
</script>
</head>
<body>
<form name=&quot;frm&quot;>
<input type=text name=&quot;txtBox&quot; onblur=&quot;CheckLen(this.value)&quot;>
</form>
</body>
</html>
 
worked great, thank you sjravee - and thank you also for your response Meteorlet &quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top