I want to make an SSN field that only allows input like 123-45-6789
Preferably it would force the dashes and of course only 11 characters (9 plus 2 dashes)
I did some searching, found there's a what appears to be very cool "Validation API" that I bet can do what I want. In fact I'm sure many people have done this already, but I can't figure out how to make this module do what I want. I went through the readme, but I didn't see what I needed to do.
I don't know PHP, so hopefully I can do what I need without it.
This is the module:
http://drupal.org/project/validation_api
Or if there's another or easier way to validate an SSN field, I'd be happy with that, but I think if I can ever figure out this API it would let me do things like phone numbers and other useful field validations.
Comments
You might want to check out
You might want to check out the Social Insurance Number module.
Perfect! I had been
Perfect! I had been searching for "SSN" and "Social Security Number", hadn't heard it called SIN and Social Insurance Number before, very cool.
So I got it installed OK and selected it in a CCK field, when I submit my form, no matter what I enter I get the following message:
"999-99-9999" is not a valid US Social Insurance Numbers
Social Insurance Numbers should be like 999-99-9999 or 999999999 ...
So I even copy/pasted the 999-99-9999 and still get the same message. And no, I'm not putting the quotes around it.
There's a patch for the SSN code
I found this patch for the SSN validator, about to test it out:
http://drupal.org/node/427826
Edit: OK, so I downloaded the patch, it's a file called "sin_0.patch".
What kind of file is that, am I supposed to extract it or something? I copied it to the modules folder but it doesn't appear to do anything.
I'm probably just not applying the patch correctly?
You can read about how to
You can read about how to apply a patch here: http://drupal.org/patch/apply.
In this case it is only a small change so you could always edit sin.module and hand apply the changes in the patch file.