Validate phone numbers

Validate phone numbers

(David AZOULAY) #1

As of version 3.1 MAINTENANCE 07, it is possible to do an advanced validation of phone numbers fields (typically in a preValidate hook.


var f = this.getFieldValue("myPhoneNumber");
f.setValue("myPhoneNumber", new PhoneNumTools("fr").getNationalNumber(f.getValue()));

NB: it is also possible to format as international format using getInternationalNumber instead of getNationalNumber

See this document for details