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

counter field by javascript dropdown menu

Community Beginner ,
Oct 09, 2017 Oct 09, 2017

Copy link to clipboard

Copied

i work this javascript code menu :

var MyItems = new Array("1","2","3");

this.getField("Dropdown14.0").setItems(MyItems);

now i want a script help if user choose option "2" then count ++ field name BOX (1...2...3..4...5..............)

i try this but not working :

count=0

if (event.value=="2")

{

count ++;

}

TOPICS
Acrobat SDK and JavaScript

Views

374

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

So you want the number value in a text field to be incremented when the user selects "2" from the dropdown? Is this correct.

If it is then enter this Validation script into the dropdown

if(event.value == 2)

     ++this.getField("Box").value;

When you are driving events from a dropdown, then the code that performs the action should be in one of the dropdown scripts that is activated on a selection. The Validation script is a good choice.

Votes

Translate

Translate
Community Expert ,
Dec 15, 2017 Dec 15, 2017

Copy link to clipboard

Copied

LATEST

So you want the number value in a text field to be incremented when the user selects "2" from the dropdown? Is this correct.

If it is then enter this Validation script into the dropdown

if(event.value == 2)

     ++this.getField("Box").value;

When you are driving events from a dropdown, then the code that performs the action should be in one of the dropdown scripts that is activated on a selection. The Validation script is a good choice.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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