Contributor II

Passport validation


Now for guest access  I´m using as a username the DNI of the guest (number of personal identification used in Spain) and I use as validator funtion "IsValidSpanishDNI".

Now I want to use as a username  the  passport number of the guest if comes from another country , but I don´t know how to validate it. Is there any funtion to do it? How can I create a new one?



Aruba Employee

Re: Passport validation

You could use the isRegexMatch validator and attempt to define your own regular expression. The problem you're going to run into is that every country is free to define their own passport numbers. You could restrict your regex to just machine readable passport numbers which appear to be 9 characters (letters or digits). 


IsRegexMatch – Checks that the value matches a regular expression supplied as an argument to the validator. The regular expression should be a Perl-compatible regular expression with delimiters. For example, the validator argument /^a/i will match any value that starts with an “a”, case-insensitively.

Search Airheads
Showing results for 
Search instead for 
Did you mean: