Populate text fields if two drop downs
- May 30, 2022
- 2 replies
- 922 views
Hello,
I am really struggling with this form.
Below is the code I have been using earlier.
var selectedPackage = this.getField("Dropdown67").value;
if (selectedPackage==" ") event.value = "";
else if (selectedPackage=="VC 500") event.value = "7200";
else if (selectedPackage=="VC 500 Upgrade") event.value = "3000";
else event.value = "";
But a recent change to the form has required displaying different values on the text field based on two drop downs.
This is the scenario.
First, drop down and select the market.
In the second drop down selects the item.
A predefined price is displayed on the text field based on these two selections.
In English, If Market is UAE, item is ITEM 1, then the price is 5000
If Market is MEA, item is ITEM 1, then the price is 1000
I have worked up below code for this,
var pack = this.getfield("Dropdown58").value;
var pack2 = this.getfield("DP2").value;
if (pack==" " && pack2==" ") event.value = "";
else if (pack=="iCom 3 Mobile" && pack2=="UAE") event.value = "2000";
else if (pack=="iCom 4 VC Box" && pack2=="UAE") event.value = "3000";
else if (pack=="iCom Trade-In" && pack2=="UAE") event.value = "4000";
else if (pack=="ZEISS Serve" && pack2=="UAE") event.value = "5000";
else if (pack=="iCom 3 Mobile" && pack2=="MEA") event.value = "100";
else if (pack=="iCom 4 VC Box" && pack2=="MEA") event.value = "200";
else if (pack=="iCom Trade-In" && pack2=="MEA") event.value = "300";
else if (pack=="ZEISS Serve" && pack2=="MEA") event.value = "400";
else event.value = "";
The code does not show any errors. However, it does not do anything.
I have attached the PDF as well here.