Participant
October 19, 2022
Answered
Making two dependent list box value 100%
- October 19, 2022
- 1 reply
- 508 views
Hi,
I have two list box elements. The values of each list box are:
0, 25. 50, 75, 100
GOAL: The value together should always be 100.
1) If I choose 25 on LIST BOX A then LIST BOX B automatically should be 75.
2) If I change the value of LIST BOX B to 50 then LIST BOX A should have 50 (GOAL)
For 1) I found this solution which I put as custom script within the list box setting calculation tab.
This works.
But If I change LIST BOX B (2) there is no change of the value in LIST BOX A.
CODE for LIST BOX A
var newIndex2 = 0;
var field1 = this.getField("Dropdown1");
var field2 = this.getField("Dropdown2");
var selectedIndex2 = field1.currentValueIndices;
var newIndex2 = (4-selectedIndex2);
field2.currentValueIndices = newIndex2;
CODE for LIST BOX B
var newIndex1 = 0;
var fieldA = this.getField("Dropdown1");
var fieldB = this.getField("Dropdown2");
var selectedIndex1 = fieldB.currentValueIndices;
var newIndex1 = (4-selectedIndex1);
fieldA.currentValueIndices = newIndex1;Any help? See attached file

