0 Replies Latest reply on Jun 30, 2015 12:41 PM by jasminep41032624

    How to Populate Text Field from Multiple Dropdowns

    jasminep41032624 Level 1

      Hello,

       

      I am trying to populate one text field with corresponding descriptions based on the selected value(s) from multiple drop down menus. Below is the code I've been using, but it only works to fill in the text for one drop down menu, if another drop down is selected the text is overwritten. Instead I would like the text from the 2nd drop down to be added to the text box from the first.

       

      • Drop Down Menu #1 has an Action setup to run a JavaScript on the trigger Mouse Up. Below is the script:

      var one = this.getField("ModelList1");

      var two = this.getField("ModelDescription");

      if(two.value==''||two.value==null){two.value=one.value;};

       

      • Drop Down Menu #1 also has a Custom Keystroke Script:

      if( event.willCommit ) {

          if(event.value == "") this.resetForm(["ModelDescription"]); else SetFieldValues(event.value);

      }

       

      • Lastly I have a Document JavaScript called SetFieldValues:

      var ModelInfo = {

      "Companion 0.A": { ModelDescription: "[Companion Portfolio 0.A] - An actively managed Mutual Fund portfolio designed to minimize portfolio risk and volatility and maximize overall portfolio returns by diversifying investments across various asset classes.  Generally for accounts with less than $50,000 in investable assets.  Target Allocation: Fixed Income (98.0%) and Cash (2.0%). The portfolio is sub-advised by Focus Point Solutions, Inc." },

      "Companion 0.B": { ModelDescription: "[Companion Portfolio 0.B] - An actively managed Mutual Fund portfolio designed to minimize portfolio risk and volatility and maximize overall portfolio returns by diversifying investments across various asset classes.  Generally for accounts with less than $50,000 in investable assets.  Target Allocation: Fixed Income (73.0%), Equities (25.0% - primarily Large Cap Domestic Equities with some exposure to International Equities), and Cash (2.0%). The portfolio is sub-advised by Focus Point Solutions, Inc." },

      "Companion 2": {ModelDescription: "[Companion Portfolio 2] - An actively managed Mutual Fund portfolio designed to minimize portfolio risk and volatility and maximize overall portfolio returns by diversifying investments across various asset classes.  Generally for accounts with less than $50,000 in investable assets.  Target Allocation: Equities (50.0% - primarily Large Cap Domestic and International Equities with some exposure to Mid Cap Domestic Equities), Fixed Income (48.0%), and Cash (2.0%). The portfolio is sub-advised by Focus Point Solutions, Inc." }};

      function SetFieldValues (cModelSelection) {

      this.getField("ModelDescription").value = ModelInfo[cModelSelection].ModelDescription;}

       

      Drop Down Menu #2 has the exact same codes except instead of saying ModelList1 it will say ModelList 2. I have no idea if I am doing this correctly or not. I'm not versed in JavaScript at all, but someone did mention creating a function that would combine the values of the fields and then call that function and use the return string from the function to populate the text field. However, I don't want the values returned as a string, I want the ModelDescription associated with each drop down value to be added to the text box as each selection is made. Hopefully this made sense.

       

      Any and all help is appreciated!!

      Thank you!