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

SSN length validator

Status
Not open for further replies.

benniesanders

Programmer
Jan 20, 2002
199
US
Greetings, I'm not very javascripty, but I have this required field (last four digits of SSN) in a form on an active server page. I am using the following code to validate the required fields but I noticed some registrants must hit the space bar to move on and I need to validate that four digits are actually entered into this field. Is there any way I can enhance or work with this particular block of code to ensure they enter four digits:
Code:
    if (form.txtSSN.value == "") {
    alert( "Please enter the last four digits of your Social Security Number." );
    form.txtSSN.focus();
    return false ;
  }
Many thanks in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top