I've researched this but none of the code I use seems to work. South African ID numbers contain date of birth and gender. All I want is it to pull in that information and verify it when their ID number is entered into an input field, preferably in jQuery or javascript
![Id number generator sample Id number generator sample](/uploads/1/2/5/8/125847973/306512634.jpg)
The next digit (C) shows if you are an SA citizen – 0 – or a permanent resident – 1. What your South African ID number reveals about you. Telkom CEO's letter to striking employees Next.
Any help is appreciated,
Dawid
Archer23.1k55 gold badges4040 silver badges5959 bronze badges
Dawid van der HovenDawid van der Hoven60666 gold badges2121 silver badges6868 bronze badges
3 Answers
You could use Koenyn's regex validation, not so sure how a single-digit number (0-9?) from the input represents the gender but basing on this tool you provided and David Russell's Using Javascript to validate South African ID Numbers, here's an untested attempt:
UPDATE 1:After following this thread, What is a South African ID number made up of?, I updated my implementation to include the gender and citizenship tests.
UPDATE 2:Forgot to wrap the month number increment
id_month + 1
within the date string fullDate
, updating solution with Dawid's fix.HTML Markup:
Javascript:
DEMO: http://jsfiddle.net/chridam/VSKNx/
chridamchridam70.8k1616 gold badges120120 silver badges153153 bronze badges
this is the validation regex we us at our company:
as far as using regex, it's really simple http://www.w3schools.com/jsref/jsref_obj_regexp.asp
KoenynKoenyn
There is a jQuery plugin that you can use. Check it out at http://www.verifyid.co.za/jqueryid
6dev6il66dev6il652511 gold badge1212 silver badges2929 bronze badges