Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help with combo boxes

Community Beginner ,
Jul 29, 2016 Jul 29, 2016

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!

TOPICS
Acrobat SDK and JavaScript , Windows
558
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Jul 29, 2016 Jul 29, 2016

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

...
Translate
LEGEND ,
Jul 29, 2016 Jul 29, 2016

It's hard to say what's wrong without looking at the form. Can you post it somewhere?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 29, 2016 Jul 29, 2016
LATEST

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!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines