Calculation to Change Numbers to a Phone Number Format
Can anyone help me fix this formula or have already working formula to change the formating of numbers. I want to have it format numbers to this (123)-123-1234.
Any help in the right direction will help. thank you so much!
-
Hi Joshua,
this is the code if @Phone Number 3 is a text field.
var phone = @Phone Number 3;
var cleanPhone = phone.replace(/[^0-9]/g,"");
cleanPhone.replace(/(\d{3})(\d{3})(\d{4})/,"($1)-$2-$3")If it is a Phone field:
var phone = @Phone Number 3;
var phone = phone.map(function (i){return i.value}).join();
var cleanPhone = phone.replace(/[^0-9]/g,"");
cleanPhone.replace(/(\d{3})(\d{3})(\d{4})/,"($1)-$2-$3")Rainer
Please sign in to leave a comment.
Comments
1 comment