Copy link to clipboard
Copied
Hello. I am working on a form that contains three dropdown boxes that have different names. All three have the same item selections, but I want each of the three to auto-fill its respective corresponding field (it is essentially a price sheet where up to three items may be selected and you would see each price listed across from it). I've gotten as far as getting the 1st drop down to populate its field using the "setvalues" script.
However, when I try to create subsequent scripts for the other two dropdowns, it seems that whichever one I create last, all three dropdown lists all populate the same field that corresponds with the most recent script I added, instead of the respective corresponding field. To clarify, after the 1st one was created, it works normally. When I create a second script for the 2nd dropdown & price field, both dropdowns only affect the 2nd price field.
I've ensured the fields have different names and those names are specified in each script. I don't understand why acrobat would allow this, when the script specifies the field I've entered. It's essentially filling a field that isn't in the script. Obviously, I'm a novice, so any insight how this process works is much appreciated!
Thanks for your reply, George! I actually just cracked it! What I was doing wrong was placing the code in the Document javascript, so it was essentially apply the script to all the dropdown boxes. What I did instead was delete that and go into each individual dropdown box and added the script as a custom format script. Just in case anyone else is doing the same thing, here's the script I'm using [some specifics ommitted to save space...]
// Place all prepopulation data into a single data str
...Copy link to clipboard
Copied
It's hard to say what's wrong without looking at the form. Can you post it somewhere?
Copy link to clipboard
Copied
Thanks for your reply, George! I actually just cracked it! What I was doing wrong was placing the code in the Document javascript, so it was essentially apply the script to all the dropdown boxes. What I did instead was delete that and go into each individual dropdown box and added the script as a custom format script. Just in case anyone else is doing the same thing, here's the script I'm using [some specifics ommitted to save space...]
// Place all prepopulation data into a single data structure
var LaborCode = { SelectCode: { cost: ""},
xyz { cost: "123.45"},
};
function SetFieldValues(cLaborCode)
{
this.getField("LaborPrice").value = LaborCode[cLaborCode].cost
}
Thanks!!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now