How can I set up a validation for the Postal Code field in an Address question?
I need suppliers / internal users to not put invalid values in the Postal Code field of the Address questions.
Is there a way to set up a validation for this field, so the system does not accept invalid values?
Follow these steps to do this:
- Go to Manage > Administration > Data Import/Export > Export, search for Country-Specific Postal Code Validations, then click the Export button.
- Open the file with a text editor, and set the regular expression / regex you want (on the internet there are sites explaining how to create these expressions) to validate the format of the accepted values for the Postal Code field.
- This expression must be entered in the fifth column in the file: you can use the first line in the file/the header to guide you.
- This must be done for each country separately; as you can see in the file, there's a specific line for each one of them.
- Make sure to use an expression to make it so the field accepts only 10 characters maximum.
Here is an example of file with custom postal validation for some countries:
Country,CountryCode,ISO,Note,Regex,ZipFormat
"Moldova","MD","MD",,"^(^MD\d{4})$|^(MD-\d{4}$)$","CCNNNN, CC-NNNN"
"Falkland Islands","FK","FK",,"^(^FIQQ\s1ZZ$)$","FIQQ 1ZZ"
"Montserrat","MS","MS",,"^[Mm][Ss][Rr]\s{0,1}\d{4}$","MSR 1110-1350"
"Singapore","SG","SG",,"^(^\d{6}$)$","NNNNNN"
Refer Defining country/region-specific postal code validation for supplier addresses for more details.
Supplier Lifecycle & Performance