Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
This is not an Acrobat issue. Talk to support for your case managment software.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
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 + ",";
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
This data merging process will not trigger the Format script, though, which is why it doesn't work for you.
Copy link to clipboard
Copied
I see. Is there another way that I can add the comma if I use the data merging process?
Copy link to clipboard
Copied
This is not an Acrobat issue. Talk to support for your case managment software.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Thanks, I will do that.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thank you!

