Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Adding Comma after Merge Field

New Here ,
Feb 03, 2025 Feb 03, 2025

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. 

TOPICS
JavaScript , PDF forms
863
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Feb 03, 2025 Feb 03, 2025

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

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

View solution in original post

Translate
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 Expert ,
Feb 03, 2025 Feb 03, 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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
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
New Here ,
Feb 03, 2025 Feb 03, 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.

Translate
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 Expert ,
Feb 03, 2025 Feb 03, 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.

Translate
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
New Here ,
Feb 03, 2025 Feb 03, 2025

I added a text box to my pdf form and added the following text  "{{Matter.PrimaryClient.FirstName}}" to the Name field. When I do this, I can merge this pdf with data from another source (my case management software). When enters their information into my case management software, I can merge that information with the pdf and the name that the client entered will populate into the text box - this is similar to how you can merge excel data into a pdf.

Translate
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 Expert ,
Feb 03, 2025 Feb 03, 2025

This data merging process will not trigger the Format script, though, which is why it doesn't work for you.

Translate
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
New Here ,
Feb 03, 2025 Feb 03, 2025

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

Translate
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 Expert ,
Feb 03, 2025 Feb 03, 2025

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

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
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
New Here ,
Feb 03, 2025 Feb 03, 2025
LATEST

Thanks, I will do that.

Translate
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 Expert ,
Feb 03, 2025 Feb 03, 2025

You can use a Calculation script, and then manually trigger the re-calculation or the entire document.

But the real solution is to get the comma to be a part of the imported data, if you can.

Translate
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
New Here ,
Feb 03, 2025 Feb 03, 2025

Thank you!

Translate
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