Copy link to clipboard
Copied
Hi.
I am kind of a beginner in creating scripts/code in Adobe and need some help. I have tried to look and tried soultions in forums, with no luck.I am creating an online form where I have two dropdowns with 5 export values in drop1 and 2 export values i drop2. depending on the combination of the two i want to display a price in a textfield. if none or only dropdown is selected, it should display 0,-. I have got it to work in Acrobat but when I upload the pdf to a web form it don`t. Syntax error when i use the same code.
Can anybody please help me?
Kind regards Martin
Copy link to clipboard
Copied
Have this code, but get syntax error:
var v1 = this.getField("modell").valueAsString;
var v2 = this.getField("avtale").valueAsString;
if (v1=="1" && v2=="a") event.value = 1990;
else if (v1=="1" && v2=="b") event.value = 2490;
else if (v1=="2" && v2=="a") event.value = 2490;
else if (v1=="2" && v2=="b") event.value = 2990;
else if (v1=="3" && v2=="a") event.value = 2990;
else if (v1=="3" && v2=="b") event.value = 3990;
else if (v1=="4" && v2=="a") event.value = 2490;
else if (v1=="4" && v2=="b") event.value = 2990;
else if (v1=="5" && v2=="a") event.value = 2990;
else if (v1=="5" && v2=="b") event.value = 4990;
else event.value = "0";
Copy link to clipboard
Copied
I`ve made a new code witch dont get a syntax error but it doesn`t returen a value in my textfield.
Somthing wrong with this code?
Drop1 called "modell" with export value 1-5
Drop2 called "avtale" with export value 8 and 9
if(modell = 1 && avtale = 8, 1990, if(modell = 1 && avtale = 9, 2490, if(modell = 2 && avtale = 8, 2490, if(modell = 2 && avtale = 9, 2990, if(modell = 3 && avtale = 8, 2990, if(modell = 3 && avtale = 9, 3990, if(modell = 4 && avtale = 8, 2490, if(modell = 4 && avtale = 9, 2990, if(modell = 5 && avtale = 8, 2990, if(modell = 5 && avtale = 9, 4990, 0))))))))))
Appreciate yor help.
Martin