Automatic Phone Number and Postal Code Field Formatting

Hi @lait, you can use this function for the phone number

function formatPhoneNumber(phoneNumberString) {
 var cleaned = ('' + phoneNumberString).replace(/\D/g, '');
 var match = cleaned.match(/^(\d{3})(\d{3})(\d{3})$/);
 if (match) {
 return '(' + match[1] + ') ' + match[2] + ' ' + match[3];
 }
 return null;
}
// example:
formatPhoneNumber(123456789)
// outputs "(123) 456 789"

For the post codes you can do this:

function formatPostCode(postCode){
 return postCode.toUpperCase().replace('-',' ');
}
formatPostCode('s0s-0s0');
// outputs "S0S 0S0"