id validator

Validate an identification number

Options

Using with form field

* presents a required option. The HTML attributes are used to set the validator options via the Declarative plugin

Name HTML attribute Type Description
country* data-fv-id___country String or Function An ISO-3166 country code
message data-fv-id___message String The error message

The validator supports the following countries (click the sample number to validate it):

# Country Abbreviation ID system Country code Sample ID Is it valid?
1 Argentinia DNI AR 2012345699
2 Bosnia and Herzegovina JMBG BA 0101006100008
3 Brazil CPF BR 231.002.999-00
4 Bulgari EGN BG 7552010005
5 Chile RUN/RUT CL 10601212-6
6 China RIC CN 22011219930407001X
7 Colombia NIT CO 2131234325
8 Croatia OIB HR 33392005962
9 Czech RC CZ 590312123
10 Denmark CPR DK 211062-5629
11 Estonia isikukood EE 37605030299
12 Finland HETU FI 310252-308Y
13 France NIR FR 253072A07300443
14 Hong Kong HKID HK G5661828
15 Iceland Kennitala IS 0902862349
16 India Aadhaar ID 496858245153
17 Ireland PPS IE 6433435IH
18 Israel Mispar Zehut IL 039337423
19 Korea RRN KR 8005151116295
20 Latvia Personas kods LV 161175-19997
21 Lithuania Asmens kodas LT 38703181746
22 Macedonia ЕМБГ MK 0101006430038
23 Malaysia NRIC MY 770305021234
24 Mexico CURP MX BOXW310820HNERXN08
25 Montenegro JMBG ME 0101006210008
26 Netherlands BSN NL 111222333
27 Norway Fødselsnummer NO 68413152112
28 Peru CUI PE 101174103
29 Poland PESEL PL 04271113861
30 Romania CNP RO 8800101221144
31 San Marino - SM 89145
32 Serbia JMBG RS 0101006720216
33 Slovakia RC SK 7103192745
34 Slovenia EMŠO SI 0101006500006
35 South Africa South African ID ZA 8001015009086
36 Spain DNI/NIE/CIF ES 54362315K
37 Sweden personnummer SE 8112289874
38 Switzerland AHV-Nr/No AVS CH 756.1234.5678.95
39 Taiwan - TW X233583559
40 Thailand - TH 2368719339716
41 Uruguay - UY 12345672

Using with ES6 module

Basic Example

You can click on sample from the table above to see if it's a valid or invalid id.

ES6 Module Example

The following snippet shows how to use the id validator with ES6 module:

More examples

Changelog

  • v1.7.0: Fixed an issue that the South African identification validator doesn't work with the minified version
  • v1.6.0: Fixed an issue that the country option isn't passed to the placeholder message

Related validators

The following validators might be useful to you.