1 Reply Latest reply on Dec 15, 2017 1:31 PM by Thom Parker

    counter field by javascript dropdown menu

    hackert25684722 Level 1

      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 ++;

      }

        • 1. Re: counter field by javascript dropdown menu
          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.