Copy link to clipboard
Copied
I have created a PDF which has form fields and a worksheet on pages 1-3. The overall PDF has over 100 pages with form fields that require the same data (different for each project) repeated on multiple pages. So I don't type the data repeatedly on each page, I enter it once on the worksheet and use an 'Action' to run a JavaScript 'On Blur' to inject the data on all the appropriate pages of the overall PDF.
The worksheet form field 'Action' JavaScript looks like this...
// Data entered in this field will populate in the fields below.
getField("field1").value = event.value;
getField("field2").value = event.value;
getField("field3").value = event.value;
getField("field4").value = event.value;
getField("field5").value = event.value;
This example is only one of about 50 fields on the worksheet. As mentioned above this only works with 'On Blur'. That's all well and good if one was entering the data on the worksheet field by field, and if the worksheet was always part of the overall PDF. When working as a team, the worksheet can get filled out separate from the overall PDF. We then insert the worksheet pages into the overall and invoke the 'On Blur' for each field of the worksheet. All data gets injected in appropriate fields just as expected.
Is it possible to place a button with a macro at the top of the worksheet to invoke an 'On Blur' for all the form fields of the worksheet, all at once or field by field, without manually needing to click in all 50 worksheet fields?
Copy link to clipboard
Copied
Why didn't you assign the same name to the fields?
Copy link to clipboard
Copied
Hello Bernd.
Because there are about 50 unique questions and answers on the worksheet and the answers repeat on multiple pages. I see your point by asking the question but it was easier to keep track the way it was set up. The example above is not the actual code. I simplified it for this post.
All that being said. I still would like a button to invoke the 'Onblur' for the fields. Any thoughts on that?
Thank you.
Copy link to clipboard
Copied
That's not possible with a script. If you really want to do something like that then use the OnBlur event to call a doc-level function, and then call that same function from the other context, but you can't "trigger" the OnBlur event itself.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more