ListBox autofill textfield from other elements in the form.
Hi.
Complete beginner here and I have been trying to find information on the forum pertaining to my dilemma but have thus far been unsuccessful sadly. Im trying to get a ListBox to add a value into a Text Field depending on what is chosen in the listbox. The ListBox contains choices which represent values in other calculated Text Fields fields. For example, I have choices Bananas, Oranges and Apples in the List Box. What I want to appear in the chosen Text Field is the amount of fruit of the chosen fruit. This information has been calculated in 3 otherText Fields on the page called either BananasAmount, OrangesAmount and ApplesAmount. Do I only need to script the Text Field where I want the information to be put or do I need to prep the ListBox or the other 3 text fields in anyway?
My searches here have given me this which does not work but might be a beginning. I have entered this into the Calculate-> Custom Calculation Script:
var v = getField("ListBox").value;
if (v == Banana)
event.value = BananasAmount;
else (v == Orange)
event.value = OrangesAmount;
if (v == Apple)
event.value = ApplesAmount;
Thankful for any help!
