Skip to main content
Participating Frequently
February 3, 2025
Answered

Adding Comma after Merge Field

  • February 3, 2025
  • 1 reply
  • 1163 views

Hi, 

I am trying to create a form letter that will merge a client's name into the pdf and then add a comma after the name, e.g. "Dear [Client's Name], ". Does anyone know what code I need to add to the javascript editor to do that? Or is there another way to do it? So far, I have only been able to create the merfe field to allow the client's name to appear, but I have not been able to get a comma to appear after the name. Any help would be appreciated. 

Correct answer Thom Parker

I see. Is there another way that I can add the comma if I use the data merging process?


This is not an Acrobat issue. Talk to support for your case managment software. 

 

 

1 reply

Thom Parker
Community Expert
Community Expert
February 3, 2025

One way to modify how data entered into a form field is shown, is with a custom format script.

Something like this.

 

if(event.value.length)

   event.value = event.value + ",";

 

 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participating Frequently
February 3, 2025

Hi, I tried that exact code based on input from another community expert but it did not work. When merge the pdf, the name populates, but the comma does not appear after the name.

try67
Community Expert
Community Expert
February 3, 2025

What do you mean by "merge the pdf", exactly? This code only kicks in when you change the field's name in Acrobat. Not when you import data into it, if that's what you're doing.