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
Solved! Go to Solution.
Views
Replies
Total Likes
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!
How are you generating the pdf?
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;
}
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!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies