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

Run script on button click

Explorer ,
Oct 28, 2021 Oct 28, 2021

Appologies if this is a repeated question, not sure I am even looking for the correct things...

 

I am creating a form (Acrobat) that updates based on simple input. It's a page of read-only text boxes, overlaying a site plan, that change color based on status. The user selects the building from one drop down (corresponds to 1 text box) and the status to update to (represented by color). Obviously I don't want missclicks to commit, so I have a button.

 

My current solution is to have a series of if's (to determine the correct color) on the text boxes. If I go that path, how do I make them run once the button is pressed?

 

While writing this, also had a thought... Should I be doing this as a script on the button? Rather than per field?

 

Thanks for any advice!

TOPICS
How to , JavaScript , PDF forms
2.4K
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 ,
Oct 28, 2021 Oct 28, 2021

If conditions only depends on one dropdown, use validation script in dropdown.

If it depends on more fields use custom calculation script or if you want to choose when to change colors then use button.

If it can be done, validation is preferred.

To use script in a button, go to button properties -> action tab -> and select 'Mouse UP' and from dropdown select 'Run a JavaScript' , of course you also need a script 🙂

 

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 ,
Oct 28, 2021 Oct 28, 2021

If conditions only depends on one dropdown, use validation script in dropdown.

If it depends on more fields use custom calculation script or if you want to choose when to change colors then use button.

If it can be done, validation is preferred.

To use script in a button, go to button properties -> action tab -> and select 'Mouse UP' and from dropdown select 'Run a JavaScript' , of course you also need a script 🙂

 

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
Explorer ,
Nov 02, 2021 Nov 02, 2021
LATEST

Thank you, Nesa!

 

I was missing the fact that you can add document level scripts. I looked for it but missed it, apparently. The button just calls a function now and that function does all the work accross fields without issue! 🙂

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