benniesanders
Programmer
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:
Many thanks in advance!
Code:
if (form.txtSSN.value == "") {
alert( "Please enter the last four digits of your Social Security Number." );
form.txtSSN.focus();
return false ;
}