Jump to content

Change Phone format Rule.


Fletch

Recommended Posts

I need to augment the 'Change Phone Format Rule' to accomodate adding a 'Space' after the Zipcode. (i.e. change (123)456-8789 to (123) 456-8789) Is this easily done? I believe I need to convert the Rule to Javascript and make the change there, but I do not know Javascript. Can anyone help?

 

Fletch

 

P.S. I'm now using FusionPro Desktop 7.1P1c. After this post I will update my signature.

Link to comment
Share on other sites

I'm not sure what the custom rules look like when converted to JavaScript, but the last line should be:

return result;

The returned variable may be something other than "result". Whatever that returned variable is, you can insert a line just before the return that reads:

result = result.replace(")",") ");

Link to comment
Share on other sites

This is the section you need to work with in the format phone rule after you change it to javascript...

 

if(CaseSelection == "Format 4")
{
var formatStyle01 = "$1.$2"; 			//simple 7 digit phone
var formatStyle02 = "($1)$2.$3";			//simple 10 digit phone
var formatStyle03 = "+$1 ($2)$3.$4";		//10 digit phone starts with 1
var formatStyle04 = "($1)$2.$3 ext.$4";		//10 digit phone with extension
var formatStyle05 = "+$1 ($2)$3.$4 ext.$5";	//10 digit phone starts with 1 with extension
var formatStyle06 = "$1.$2 ext.$3";		//7 digit phone with extension

var thisNumber = Field(Var1);

return formatNumber(Trim(thisNumber));
}

 

change it to read as follows:

 

if(CaseSelection == "Format 4")
{
var formatStyle01 = "$1.$2"; 			//simple 7 digit phone
var formatStyle02 = "($1) $2.$3";			//simple 10 digit phone
var formatStyle03 = "+$1 ($2) $3.$4";		//10 digit phone starts with 1
var formatStyle04 = "($1) $2.$3 ext.$4";		//10 digit phone with extension
var formatStyle05 = "+$1 ($2) $3.$4 ext.$5";	//10 digit phone starts with 1 with extension
var formatStyle06 = "$1.$2 ext.$3";		//7 digit phone with extension

var thisNumber = Field(Var1);

return formatNumber(Trim(thisNumber));
}

 

Hope this helps.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...