These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Phone number won't print in phone # format

David Dunn
Registered: Oct 28 2010
Posts: 116
Answered

I am using the new Report() function and have variables set in a JavaScript for a phone field and fax number field that are part of my pdf. One of the two won't print in the report in phone number format.
 
Both of these fields are formatted exactly the same as "special" phone number-formatted fields. I have the report set to include the data entered as follows:
 
rpt.writeText("Phone: " + Phone.value)
rpt.writeText("Fax: " + Fax.value)
 
When the report is generated the first field prints in the report as the 10 numbers in the field with no hyphens (and no spaces) after the area code and phone prefix; just the 10 numbers (i.e. 2345678910). The second field prints in phone number format, with correctly placed hyphens, i.e., 234-567-8910.
 
Any assistance in what may be causing the first not to include the hyphens while the second number does would be greatly appreciated.
 
David

David D

My Product Information:
Acrobat Pro 9.4, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Accepted Answer
That is the value of the field in JavaScript. You can use the 'util.printx()' method to format value to the phone number formatted string.

rpt.writeText("Phone: " + util.printx('999-999-9999', Phone.value) );
rpt.writeText("Fax: " + util.printx('999-999-9999', Fax.value) );

George Kaiser

David Dunn
Registered: Oct 28 2010
Posts: 116
George, I hope this reaches you. Thank you for your help. That worked perfectly. From your description under your profile it sounds like we got started similarly, though you are about 9 years ahead of me. I have both of John Dubert's books and have worn the pages out studying them and adapting them to my purposes, with great success, but I find studying JavaScript challenging. I'll be posting more questions I'm sure, but do appreciate your help very much.

David D