Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Phone Number Format does not transfer to text fields

Avatar

Avatar
Boost 1
Level 1
Duquette
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
Duquette
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
Duquette
Level 1

04-02-2021

I am working on a form where the user enters their information in fields to generate a report. How can I  keep the formatting for the phone numbers entered into the field to transfer to the text field. when the report is generated? I need (123) 456-7890 but end up with 1234567890

acrobat DC javascript

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

139 likes

Total Posts

188 posts

Correct Reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

139 likes

Total Posts

188 posts

Correct Reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile
Manjunath_K
MVP

04-02-2021

@Duquette,

Have you tried adding custom logic in javascript to format this phone number? if not please try adding below logic to format phone number with 10 digits.

 

var phoneNumber = '1234567890';

if(phoneNumber.length == 10){
phoneNumber = '('+phoneNumber.substr(0,3)+') '+phoneNumber.substr(3,3)+'-'+phoneNumber.substr(6); //returns formatted phone number (123) 456-7890
}

 

Hope this helps! 

Answers (2)

Answers (2)

Avatar

Avatar
Boost 1
Level 1
Duquette
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
Duquette
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
Duquette
Level 1

04-02-2021

I am assigning the value to a variable then recalling it in the report..

 

// Primary Contact Information;

if (pcn.value === ""){
event.value = "Primary Contact:\n\n\nNo Primary Contact on File";
}
else{

event.value = "Primary Contact:\n\n"+pcn.value+"\nWork: "+pcp.value+"\nCell: "+pcpc.value+"\nEmail: "+pce.value;
}

Avatar

Avatar
Ignite 1
Level 7
GirishBedekar
Level 7

Likes

163 likes

Total Posts

233 posts

Correct Reply

36 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Ignite 1
Level 7
GirishBedekar
Level 7

Likes

163 likes

Total Posts

233 posts

Correct Reply

36 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
GirishBedekar
Level 7

04-02-2021

How are you generating the pdf?