How to automatically populate a field based on the item selected in a drop down list
Hello Adobe Community Brains Trust,
I am currently using Adobe Acrobat DC Pro 2015 and am a complete javascript noob!
I am trying to create a fillable PDF client order form - there is a drop-down field called Nutrition Product (20 items) and another field called Nutrition Product code, and I want to set the following action:
- If Product 1 is selected in the Nutrition Product drop-down list, Product 1 code will automatically populate in the Nutrition Product Code field, and so on..
For each of the products in the drop- down list, I have included the product code in the Export Value field in the Options tab.
I have read a few articles and tried the below javascript code in the Nutrition Product field, however the Nutrition product code field is not auto-populating with the code number. Where am I going wrong? Any advice would be gratefully received. Many thanks TJ 😊
if(event.value == "Ensure Powder Vanilla 850g can"){
this.getField("Nutrition_Product_Code").value = "S619.185";}
else if(event.value == "Ensure Powder Chocolate 850g "){
this.getField("Nutrition_Product_Code ").value = "S620.185";}
else {
this.getField("Nutrition_Product_Code").value = "";}
