Copy link to clipboard
Copied
Hi.
I am kind of a beginner in creating scripts in adobe and need some help with what i think is a very simple solution. i have tried to look and try 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,-
Can anybody please help me?
Kind regards Martin
Copy link to clipboard
Copied
You can use something like this code as the custom Calculation script of the text field (adjust the field names as values as needed, of course):
var v1 = this.getField("Dropdown1").valueAsString;
var v2 = this.getField("Dropdown2").valueAsString;
if (v1=="Option1" && v2=="Option2") event.value = 10;
else if (v1=="Option1" && v2=="Option3") event.value = 15;
else if (v1=="Option2" && v2=="Option1") event.value = 23.4; // etc.
else event.value = "";
Copy link to clipboard
Copied
Thanks for the quick reply, i`ll try that.
Copy link to clipboard
Copied
I got an "unexpected field v1". Just to let you know, im doing this in web form in adobe.
here is my code:
var v1 = this.getField("modell").valueAsString;
var v2 = this.getField("avtale").valueAsString;
if (v1=="1" && v2=="a") event.value = 1.990;
else if (v1=="1" && v2=="b") event.value = 2.490;
else if (v1=="2" && v2=="a") event.value = 2.490;
else if (v1=="2" && v2=="b") event.value = 2.990;
else if (v1=="3" && v2=="a") event.value = 2.990;
else if (v1=="3" && v2=="b") event.value = 3.990;
else if (v1=="4" && v2=="a") event.value = 2.490;
else if (v1=="4" && v2=="b") event.value = 2.990;
else if (v1=="5" && v2=="a") event.value = 2.990;
else if (v1=="5" && v2=="b") event.value = 4.990;
else event.value = "";
Copy link to clipboard
Copied
What do you mean by "a web form"?
Copy link to clipboard
Copied
im creating an online webform here https://acrobat.adobe.com/link/home/
because it needs to be filled out a signed online from customers. I uploaded a pdf, and you create fields online. I treid before with a ready form with codes made in acrobat, but the online webform app did not understand the codes. so i try now from scratch.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Yeah, that won't work. You'll need to create a regular PDF file in Acrobat to be able to do it.
Copy link to clipboard
Copied
So, i got i to work in Acrobat. so thank you for that :-). But its not ideal for the way we want to use it. Need the cutsomer and us to be able to use adobe sign. So is there any way to get it to work with a code in webform?
Copy link to clipboard
Copied
Sorry, I don't know. Try the Adobe Sign forum.
Copy link to clipboard
Copied
I got an "unexpected field v1". Just to let you know, im doing this in web form in adobe.
this is my code:
var v1 = this.getField("modell").valueAsString;
var v2 = this.getField("avtale").valueAsString;
if (v1=="1" && v2=="a") event.value = 1.990;
else if (v1=="1" && v2=="b") event.value = 2.490;
else if (v1=="2" && v2=="a") event.value = 2.490;
else if (v1=="2" && v2=="b") event.value = 2.990;
else if (v1=="3" && v2=="a") event.value = 2.990;
else if (v1=="3" && v2=="b") event.value = 3.990;
else if (v1=="4" && v2=="a") event.value = 2.490;
else if (v1=="4" && v2=="b") event.value = 2.990;
else if (v1=="5" && v2=="a") event.value = 2.990;
else if (v1=="5" && v2=="b") event.value = 4.990;
else event.value = "";