Combine Text Box with text while keeping Phone Number Format

Community Beginner ,
May 19, 2022 May 19, 2022

Copy link to clipboard

Copied

Good Afternoon, 

 

I am trying to combine Text and a Text Box with a phone number but keeping the phone number format. 

I am using 

event.value = "If you have any questions, please do not hesitate to call me at " + this.getField("Phone Number").value + ".";

 

But the Phone Number does not keep it's formatting. 

 

Any Assistance would be greatly appreciated. 

TOPICS
Create PDFs , JavaScript , PDF forms

Views

54

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , May 19, 2022 May 19, 2022

Thats because it uses value you enter in a phone field, what you see in that field is just formatting.

In your calculation you can set format using 'printx', like this:

var f = this.getField("Phone Number");
var nFormat = util.printx("999 999-9999", f.valueAsString);
if(f.value)
event.value = "If you have any questions, please do not hesitate to call me at " + nFormat + ".";
else
event.value = "";

 

Change "999 999-9999" to the format you want.

Likes

Translate

Translate
Adobe Community Professional ,
May 19, 2022 May 19, 2022

Copy link to clipboard

Copied

Thats because it uses value you enter in a phone field, what you see in that field is just formatting.

In your calculation you can set format using 'printx', like this:

var f = this.getField("Phone Number");
var nFormat = util.printx("999 999-9999", f.valueAsString);
if(f.value)
event.value = "If you have any questions, please do not hesitate to call me at " + nFormat + ".";
else
event.value = "";

 

Change "999 999-9999" to the format you want.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

LATEST

That worked great. Thank you very much! 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines