counter field by javascript dropdown menu

Community Beginner ,
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 ++;

}

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

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.

TOPICS
Acrobat SDK and JavaScript

Views

119

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

counter field by javascript dropdown menu

Community Beginner ,
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 ++;

}

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

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.

TOPICS
Acrobat SDK and JavaScript

Views

120

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
Oct 09, 2017 0
Adobe Community Professional ,
Dec 15, 2017

Copy link to clipboard

Copied

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.

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