Skip to main content
Participating Frequently
August 17, 2017
Answered

Script help - Auto fill combo box from another combo box

  • August 17, 2017
  • 3 replies
  • 975 views

I have been trying to follow instructions on how to create combo which auto pop another combo and intern that combo box auto pop other cells.  I used an existing sample script and tried to replace there var and objects with mine but it not functioning. Can someone review my script?

I have 6 cells goals, tactics, results, budget, action, tips. Both goals and tactics are combo boxes/drop boxes and the remain four are auto pop from the tact selection.

Please note i am very new to coding and trying my very best.

******

var oTactRef = {

    "Everyday client meetings":{result:"5 referrals", budget:0, action:"Make asking for Introductions a regular part of the client meeting.", tips:"Use these meetings to initiate your new Value Discussion initiative"},

    "Phoenix Conversations": {results:"10 refferrals", budget:100, action:"Reignite your current client base by booking meetings to discuss your new brand in-depth", tips:"Let them know that their experience is valuable and that you always welcome their feedback on how you can improve"} ,

    "Client Survey Results":{results:"8 referrals", budget:150, action:"Set up reminders to regularly send clients the survey 30 to 60 days before a meeting or anniversary.", tips:"Do NOT mention to your client that you reviewed their client survey responses. They are meant to be anonymous."},

              };

var oTactDigt ={

    "Sourcing through LinkedIn":{results:"25 followers", budget:0, action:"Search for and add 10-15 clients from your list on LiknkedIn per day.",tips:"Always be prepared withw soft opening"},

    "feacebook sponsored post":{results: "30 new followers", budget:1000, action:"Run a sponsored Facebook campaign aimed at the strategic locations you have identified", tips:"Using Facebooks bidding platform for Sponsored posts, we will work with an initial budget of $500 and focus the activity around certain days, times and areas."},

    "Facebook activity":{results:"10 new followers", budget:0, action:"Every day visit www.igcontenthub.com and post 1 piece of content to your team page.", tips:"When choosing content to post, make sure to be as relevant to the day as possible."},

  };

var oGoals = {

              //"Increase New Assets":{Tactics:oTactAss},

              //"Increase Share of Wallet":{Tactics:oTactWal},

              "Increase Referrals":{Tactics:oTactRef},

              //"Increase Insurance Cases":{Tactics:oTactRef},

              //"Increase Mortgages":{Tactics:oTactMor},

              //"Increase Brand Awareness":{Tactics:oTactBrnd},

              //"Increase Volunteer-ism":{Tactics:oTactVol},

              "Increase Digital Footprint":{Tactics:oTactDigt}

              //"Increase Campaign Use":{Tactics:oTactCamp}

                     };

function SetListItems(oDataSelection, oListFld)

{

  var oListSel = oDatascource.Tactics;

  var aItemList = [" - "];

  for(var cName in oListSel)

     aItemList.push(cName);

  var prevVal = oListFld.value;

  oListFld.setItems(aItemList);

    oListFld.oDataSource = oListSel;

    oListFld.oDataSource[" - "] = {results:oDataSelection.results, budget:oDataSelection.budget, action:oDataSelection.action, tips:oDataSelection.tips,};

  oListFld.defaultValue = " - ";

  oListFld.value = bBlockValueChanges?prevVal:" - ";

}

function  SetFieldValues(cSel, oDataSource, oResultFld, oBudgetFld, oAction, oTips)

{

   if(oDataSource && cSel && !bBlockValueChanges)

   {

      var oItemVals = oDataSource[cSel];

      oResults.value = oItemVals?oItemVals.results:"";

      oBudget.value = oItemVals?oItemVals.budget:"";

      oAction.value = oItemVals?oItemVals.action:"";

      oTips.value = oItemVals?oItemVals.tips:"";

   }

}

var bBlockValueChanges = (this.getField("Goal_1").value != "");

SetListItems({price:"", budget:"", Tactics: oGoals},this.getField("goal_1"));

var bBlockValueChanges = (this.getField("Goal_2").value != "");

SetListItems({price:"", budget:"", Tactics: oGoals},this.getField("goal_2"));

var bBlockValueChanges = (this.getField("Goal_3").value != "");

SetListItems({price:"", budget:"", Tactics: oGoals},this.getField("goal_3"));

bBlockValueChanges = false;

This topic has been closed for replies.
Correct answer Thom Parker

Hello Jennifer,

   I posted the fix for your code in the other thread.

3 replies

Bernd Alheit
Community Expert
Community Expert
August 17, 2017

Where did you read the instructions?

Participating Frequently
August 17, 2017

pdfscripting.com  is were i was following instructions from - Run by Thom Parker. I have sent a email to him as well, but not sure when he will reply.

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
August 17, 2017

Hello Jennifer,

   I posted the fix for your code in the other thread.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often