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

Validation 1

Status
Not open for further replies.

steveflit

Programmer
Jun 25, 2001
7
US
Can anyone explain how I can validate a certain field criteria at the client using javascript. I have an inpubox that requires a 9 length alphanumeric string in the format
Letter, Letter, Number,Number,Number,Number,Number,Number,Letter eg (JC747474C)
Thanks for any help
Steve
 
steveflit,

Try the following:

var reg = /^\w{2}\d{6}\w{1}$/;
var value = document.myform.myfield.value

if (reg.test(value)) {
alert(value + " is in the correct format");
}
else {

alert("Please enter a value in the correct format");
}

Hope this helps.

Mise Le Meas,

Mighty :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top