9 Replies Latest reply on Apr 5, 2012 10:02 AM by virgonightingale

    Multi-line Dropdown...

    virgonightingale

      I'm designing a customizable award certificate for a client. They want the name of the actual award itself to be chosen from a list. Most easily done with a drop-down. Problem is, some of the award names are long and would need to be set on two lines. PLUS, I would like for it to be centered. Neither of these are options for a dropdown.

       

      I found a bit of javascript that takes the chosen dropdown item and exports it to another box that I can allow centering and multi-lines. I adapted it to the text I would need, but I can't get it to work. My brain does NOT do code (I'm pretty much just a print designer), so I can't figure out what I'm doing wrong.

       

      This is the code that I have in the 'styled' text box named awardName (under Format > Custom > Custom keystroke script):

       

       

      // Custom Keystroke script for combo box

      (function () {

       

      if (!event.willCommit) {

       

      // Set up an array of addresses. \r = carriage return

      var aAward = [];

      aAward[0] = "Top Sales Professional\rfor Listing Units";

      aAward[1] = "Top Sales Professinoal\rfor Listing Volume";

      aAward[2] = "Top Team\rfor Listing Units";

      aAward[3] = "Top Team\rfor Listing Volume";

       

      // Get the export value of the selected item

      var ex_val = event.changeEx;

       

      // Get the corresponding address

      var award = aAward[ex_val];

       

      // Populate the text field with the address

      getField("nameAward").value = award;

      }

       

      })();

       

       

      In the dropdown itself (named nameAward), I gave each of the award names a respective export value of 0, 1, 2, and 3.

       

      When I test, I choose a dropdown option, but nothing shows up in the text box. What gives? I'm sure I'm doing something wrong, but I just don't know what.