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

how to add javascript to show/hide field

New Here ,
Jul 10, 2019 Jul 10, 2019

Copy link to clipboard

Copied

i have tried 2 methods to add a way to show/hide a label from a dropdown event.
method 1 - add to the dropdown > format > custom keystroke script

var lblServiceUnit = this.getField("lblServiceUnit");

var FacilityType = this.getField("Facility Type");  

console.println(FacilityType.value);

if (FacilityType.value=="Federal") {  

    lblServiceUnit.display = display.visible;    

} else {  

    lblServiceUnit.display = display.hidden;    

}

when i change the drop down it always seems to printout the last value and not the current value. i am changing the dropdown via mouse.

method 2 -
dropdown > actions > select trigger > ? mouse up or onblur or mouse exit
the javascript added here is the same as above but it does not seem to fire at the right time. i have to click out and sometimes click back into the dropdown to see it fire.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

583

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
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 10, 2019 Jul 10, 2019

Go to the properties of the drop-down and under the Options tab tick the "Commit selected value immediately".

Votes

Translate

Translate
Community Expert ,
Jul 10, 2019 Jul 10, 2019

Copy link to clipboard

Copied

Move the code to the validation event and use event.value instead of FacilityType.value .

Votes

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
community guidelines
New Here ,
Jul 10, 2019 Jul 10, 2019

Copy link to clipboard

Copied

this event.value at this point in validation event works but ONLY when you focus off the drop down.
same thing for the events in the ACTION tab (on blur, on mouse down enter exit)
for the ACTION (on mouse down enter exit) the event is blank and the direct value is unchanged UNTIL i defocus off the dropdown.
for the ACTION (onblur) it correctly works as validation event works but ONLY when you focus off the drop down.

is there no way to this to fire when the drop down changes but does not lose focus?
i am having 3 different options show up after selecting a choice from the dropdown. it seems confusing that the end user won't see those options UNTIL he defocuses off the dropdown.

so i can get this working but seems unfriendly to the end user.

Votes

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
community guidelines
Community Expert ,
Jul 10, 2019 Jul 10, 2019

Copy link to clipboard

Copied

LATEST

Go to the properties of the drop-down and under the Options tab tick the "Commit selected value immediately".

Votes

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
community guidelines