Delay in message toggle on Adobe [Acrobat] forms

New Here ,
Jun 28, 2019

Copy link to clipboard

Copied

I've written a simple script, but cannot seems to figure out why am I experiencing a delay in the toggle of the message.

I have a textbox that sum's up values selected on 3 drop down lists. All have been formatted as numbers. The sum works just fine.

I have another textbox that stores the above total and I have added a script to display a message if the value if greater than 100 or less than 100.

The message displays after a lag. For example, if the total selected is greater than 100 and i use the dropdown to select that now makes the value less than 100, the message does not switch unless i make a second change on the drop down.

here is the code:

if (this.getField("Text2").value < 100) {

this.getField("message1").display = display.visible;

this.getField("message2").display = display.hidden; }

if (this.getField("Text2").value > 100) {

this.getField("message2").display = display.visible;

this.getField("message1").display = display.hidden; }

I guess i am missing some kind of event trigger when the drop down is changed. I tried to place the script on the dropdowns as well, but no luck.

help is much appreciated!

[Title edited by moderator to include “Acrobat”. Adobe is the company; Acrobat is the software.]

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Move it back to the Validation event, and change all instances of this:

this.getField("Text2").value

To:

event.value

TOPICS
Acrobat SDK and JavaScript

Views

138

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Delay in message toggle on Adobe [Acrobat] forms

New Here ,
Jun 28, 2019

Copy link to clipboard

Copied

I've written a simple script, but cannot seems to figure out why am I experiencing a delay in the toggle of the message.

I have a textbox that sum's up values selected on 3 drop down lists. All have been formatted as numbers. The sum works just fine.

I have another textbox that stores the above total and I have added a script to display a message if the value if greater than 100 or less than 100.

The message displays after a lag. For example, if the total selected is greater than 100 and i use the dropdown to select that now makes the value less than 100, the message does not switch unless i make a second change on the drop down.

here is the code:

if (this.getField("Text2").value < 100) {

this.getField("message1").display = display.visible;

this.getField("message2").display = display.hidden; }

if (this.getField("Text2").value > 100) {

this.getField("message2").display = display.visible;

this.getField("message1").display = display.hidden; }

I guess i am missing some kind of event trigger when the drop down is changed. I tried to place the script on the dropdowns as well, but no luck.

help is much appreciated!

[Title edited by moderator to include “Acrobat”. Adobe is the company; Acrobat is the software.]

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Move it back to the Validation event, and change all instances of this:

this.getField("Text2").value

To:

event.value

TOPICS
Acrobat SDK and JavaScript

Views

139

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 28, 2019 0
Most Valuable Participant ,
Jun 28, 2019

Copy link to clipboard

Copied

Please post the name of the program you use so a Moderator may move this message to that forum

-A program would be Dreamweaver or Muse or Acrobat or ???

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 28, 2019 0
New Here ,
Jul 01, 2019

Copy link to clipboard

Copied

The program I am using is Adobe Acrobat XI Pro

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 01, 2019 0
Adobe Community Professional ,
Jul 01, 2019

Copy link to clipboard

Copied

I‘ve moved this from Adobe Creative Cloud to PDF Forms.

~ Jane

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 01, 2019 0
Most Valuable Participant ,
Jul 01, 2019

Copy link to clipboard

Copied

Where did you place the code?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 01, 2019 0
New Here ,
Jul 01, 2019

Copy link to clipboard

Copied

I tried placing the code on the "Text2" textbox that holds the sum on the 'validate' tab > run a custom validation script.

I also tried placing the code under the 'Actions' tab and set multiple triggers: mouse up/down/exit and run a javascript, that didnt work too.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 01, 2019 0
Most Valuable Participant ,
Jul 01, 2019

Copy link to clipboard

Copied

Move it back to the Validation event, and change all instances of this:

this.getField("Text2").value

To:

event.value

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 01, 2019 0
New Here ,
Jul 01, 2019

Copy link to clipboard

Copied

thank you try67​! That definitely helped to fix my issue. I appreciate your help!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 01, 2019 0