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

Button to invoke an 'On Blur' JavaScript Action

New Here ,
May 09, 2017 May 09, 2017

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?

TOPICS
Acrobat SDK and JavaScript
2.8K
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 ,
May 09, 2017 May 09, 2017

Why didn't you assign the same name to the fields?

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 ,
May 15, 2017 May 15, 2017

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.

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 ,
May 15, 2017 May 15, 2017
LATEST

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.

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