In the image above. Is it possible to prepopulate the Risk Level field based on the value of Likelihood and Severity?
The risk level column need to produce a score from the multiplying the likelihood by the severity selections.
Also, the risk level field bg color needs to change depending on the calculated value (low - green, medium - yellow, high - red)
This is the list for each the dropdown list
I'm currently using Adobe LiveCycle ES4
This is a FormCalc solution
Firstly, give the combo items a value.
On the Object > Binding Tab for your dropdownlist, check the box that says Specify Item Values to give a numerical value to each item
In my example i have three combos and the Risk Level heading is a textfield, not a text object (it needs to be to be coloured in code).
Note: I have the code triggering on the combo exit event which triggers after you click on an item in the combo box. You will need to add the same code to both the first and second dropdownlists so either performs the calculation.
This is my exit code (formCalc):
form1.#subform.Table1.Row2.DropDownList2::exit - (FormCalc, client)
var ddl1 = DropDownList1.rawValue
var ddl2 = DropDownList2.rawValue
var calc = ddl1 + ddl2 //calculate the dropdownlist values
//if the variable is equal to or greater than 1 and less than 4, select the first item and colour the heading green
if(calc >= 1 and calc < 4)
DropDownList3.rawValue = "1"
//if the variable is greater than 3 and less than 10, select the second item and colour the heading yellow
if(calc > 3 and calc < 10)
DropDownList3.rawValue = "2"
//if the variable is 10, select the third item and colour the heading red
if(calc == 10)
DropDownList3.rawValue = "3"
After making the selection of a second combo, the third combo changes and the title fills with colour.
As there is only 10 options in the calculation, you could also use a switch instead of if expression for this, but this is one case where an if expression is more compact.
if ddl1 is 2 and ddl2 is 3.
var calc = ddl1 + ddl2 //in formcalc the variable will be 5 (2+3)
Thank you so much MinusZero