textfield

Saudi Iqama/National Identity number field validation


Can someone help me with the criteria for field validation for Saudi iqama/National Identification number?

I know for Nationals it should start with 1 and for expats, it should start with 2 and the length should be 10.Anything else. This is for an application which has already seen some bad incoming data creating bugs, so don't want to take chances. Thanks in advance.


Solution

  • For (Id Type=’National Id’)  length = 10 , Id Number must start with ‘1’ in position 1. Multiply every number in an Odd Position (characters in positions 1,3,5..9) by 2. If the multiplication yields a 2 digit number then summate these 2 digits to yield a single digit. Summate the first 9 Characters for the ID number (post multiplication) to yield a 2 digit number (XY). If 10th digit of the ID number equals to “Zero”, then subtract 10 by the digit in position 2 (Y) in the summation total of the first 9 characters to yield a 2 digits (ZN), (N) should be equal to the 10th digit of the ID Number. Else, the 10th digit of the ID Number should be equal to 10 subtracted by the digit in position 2 (Y) in the Summation total of the first 9 Characters.