Copy link to clipboard
Copied
Hello, I'm new at this.
I am doing a PDF form and would like to fill a text box with the address of a vendor, once I selected the vendors name in a drop-down menu. I am using Adobe Acrobat Pro DC, and having issue on what scrip to use and where to put it.
Any help would be appreciated. Thanks in advance.
Hello,
You can follow below steps to put your javaScript :
Right click on your text-box.
Under Calculate tab->custom calculation script, put the below javaScript :
event.value = this.getField("<Your dropdown name>").value;
Copy link to clipboard
Copied
Hello,
You can follow below steps to put your javaScript :
Right click on your text-box.
Under Calculate tab->custom calculation script, put the below javaScript :
event.value = this.getField("<Your dropdown name>").value;
Copy link to clipboard
Copied
How would i do the same thing but have a drop down box with several items (they all equal different values)
Copy link to clipboard
Copied
The same code can be used with a drop-down field.
Copy link to clipboard
Copied
Hello - I have a similar situation in a form, but struggling with figuring out a specific need.
I want only one specific selection in a dropdown menu to populate into a textfield (a reminder, based on the selection).
Text field name: "flag"
Drop down name: "type_vendor"
Drop down options:
I want the read-only text field blank, unless the "CE" option is selected from the drop down.
This script works fine and I've used others that include multiple values from a list box, but the exclusivity part of only wanting one value or blank is throwing me off..
Any help or insight is appreciated!
Copy link to clipboard
Copied
also - the export value of "CE" should have been indented further, it is not one of the drop-down options! my bad.
Copy link to clipboard
Copied
As custom calculation script of text field use this:
event.value = this.getField("type_vendor").valueAsString == "Remember to complete page two for CE vendors" ? this.getField("type_vendor").value : "";
EDIT: you want export value to show or CE?
Copy link to clipboard
Copied
I want the export value to show only when that specific drop menu item is selected (CE). Blank for all other selections from the drop down.
I must be mising something in the code?
event.value=this.getField("type_vendor")
.valueAsString == "Remember to complete page two for CE Vendors" ? this.getField("type_vendor").value:"";
This code was working to populate each drop down selection's export value, but adding the specifics doesn't like me today...
event.value=this.getField("type_vendor").value;
Copy link to clipboard
Copied
Script will populate "flag" field with export value from item 'CE' if 'CE' is selected from dropdown field and leave field "flag" blank if anything else is selected from dropdown field.
Can you explain what you want to achive with second script and where do you use it?
Copy link to clipboard
Copied
The second code was where I started (sorry super backwards way of explaining).
I figured it out - my export value of CE was not matching up with the code value! I phrased it slightly different. Thank you so much for your help!
Copy link to clipboard
Copied
I am working on a similar form. I have a sales order form where I have dropdowns for different misc charges. I would like it so that when my sales team selects an item from the dropdown it populates a price into a text box, and if nothing is selected, then I would like the text box to remain empty or populate 0.
One of the dropdowns is "Title", and my textbox is "MiscAmount1". I have tried to use the code above as my base and then tweaked it how I thought it would have to be and I either get the value that I want regardless of what is selected in the dropdown or I get nothing.
Copy link to clipboard
Copied
This is confusing me to now end: Below is my script. I cannot find the error and it does not work in either the calculate tab or the run a java script tab. Please assist.
var selectedUnit = this.getField("Unit").value;
if (selectedUnit=="1st Brigade (Engineer)") event.value = "AFRC-TVA-LWA";
else if (selectedUnit=="1st Battalion (Engineer) 80th Regiment") event.value = "AFRC-TVA-LWAA";
else event.value = "";
i HAVE MORE LINES TO ADD BUT i FIGURED IT WOULD BE EASIER TO EXPLAIN OR COMPREHEND WITH JUST A FEW LINES.
Copy link to clipboard
Copied
Is "Unit" dropdown or text field?
By the look of it, it should work fine.
If it's dropdown field make sure under field properties -> option tab check 'Commit selected value immediately'