Update Phone Format (206) 800-1234 in Zoho Creator

31.01.18 07:40 AM - By CreatorScripts


You can add the below script On Add On Validate or On Add On Success. Just replace the name of the input.Phone_additional field with the name of your phone field in your zoho form.

//Update Phone format
if ((input.Phone_additional.getAlphaNumeric().length() != 10) && (input.Phone_additional != ""))
{
errors = List:String();
errors.add("Phone Number is not a 10 digit number.");
}
else if ((input.Phone_additional != "") && (input.Phone_additional.getAlphaNumeric().length() == 10))
{
input.Phone_additional = thisapp.Update.PhoneFormat(input.Phone_additional);
}
else
{

}

The script above calls a function to update the Phone string. You can name your function the same as the one in this example so you can only copy & paste the script. If you name your function differently just make sure to adjust the function name in your script as well.

CreatorScripts