Copy link to clipboard
Copied
I am creating a form to use as an invoice. I want a text field to populate dependent on a dropdown selection. My dropdown is titled "Expense" and it holds Option 1, Option 2 and Option 3. If Option 1 is chosen, the "Total" field shoudl be "$85", Option 2 and 3 = "$125". Every script I have tried isn't working. Any sugestions is appreciated.
Copy link to clipboard
Copied
As custom calculation script of "Total" field use this:
var drop = this.getField("Expense").valueAsString;
if(drop == "Option 1")event.value = 85;
else if(drop == "Option 2" || drop == "Option 3")event.value = 125;
else
event.value = "";
Copy link to clipboard
Copied
It still isn't working for me. I am very new at this. Does this look correct to you?
var drop = this.getField("Expense").valueAsString;
if(Total == "Transport from scene to morgue")event.value = 85;
else if(Total == "Transport from morgue to ME")event.value = 125;
else if(Total == "Transport from ME to morgue")event.value = 125;
else event.value = "";
Copy link to clipboard
Copied
No. Why did you replace "drop" in line 1 with "Total" in the other lines?
Copy link to clipboard
Copied
I am very new at this aspect of the program. I changed them all back to "drop" and it still doesn't work. It now says:
var drop = this.getField("Expense").valueAsString;
if(drop == "Transport from scene to morgue")event.value = 85;
else if(drop == "Transport from morgue to ME")event.value = 125;
else if(drop == "Transport from ME to morgue")event.value = 125;
else event.value = "";
It still isn't populating but isn't throwing any errors. Any help appreciated.
Copy link to clipboard
Copied
Check that field name and dropdown choices are all correct.
If you have export value set in dropdown then change "Transport from scene to morgue" to the export value...etc.
If nothing works, please share your file with us.
Copy link to clipboard
Copied
I finally got it! I had to put it to the side for a few days. Thank you so much! I need to create multiple rows using the same exact thing. Is there a simple way to do that without having to redo the javascript on each one?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more