Expand my Community achievements bar.

Adobe Designer 7.0 drop-down list?

Avatar

Level 2

Is it possible to have a drop-down list showing two columns of data and only posting the value?

Example:


Field Name: Sex
Field Options: M Male
F Female

Obviously this example is simplistic.. I want to show the full description but when user selects "Male".. I want to display the value "M"..

Thanks for your time in advance..

... Sherri
1 Reply

Avatar

Level 2

Solution...

This is to all who have been trying to find an answer .. I'm using Adobe LiveCycle Designer 7.0.. I updated Adobe Reader to 9.1.3

This allows you to see the lookup field text for a field and place the value instead of text.. If user selected the wrong option.. User can go back and select another choice.

Thank you "chandra sekhara varma nimmagadda" for your assistance and patience!My apologies for not closing this sooner.


... Sherri


.............................................

Create a hidden text field called "TryDDBackup"

Create a DropDown list field called "TryDD"

   Make sure that you specify item menus is checked and you have your Value and Text listed in the table..

   In my situation I had:

             L     Long

             M    Medium

             S     Short

Add the following code:

----- form1.#subform[0].TryDD::initialize - (JavaScript, client) -----------------------------------

var ddList = "";                         //variable to hold the list for this instance
                                         //xfa.host.messageBox(""+this.length)//to display totoal number of listed options in this dropdown
var numberOptions = this.length;         //to hold the value of number of items in the options list
TryDDBackUp.rawValue = ""               //set the related hidden textbox value to null
for (i=0;i<this.length;i++) {
                                 //xfa.host.messageBox(""+this.getDisplayItem(i));
ddList = ddList + "***" + this.getDisplayItem(i) + "~" + this.boundItem(this.getDisplayItem(i));
                                       //construscting value with display text and it's value to use later
}
TryDDBackUp.rawValue = ddList;        //now save the constructed value to related invisible textbox for future use.

this.clearItems();                   //will clear options list but we do not have to worry as we saved all the values
                                     //in the related invisible textbox. We will load them in "preOpen" event

----- form1.#subform[0].TryDD::exit - (JavaScript, client) -----------------------------------------

var selectedVal = this.rawValue; //currently selected value
this.clearItems(); //again clear list for this DD
this.addItem(selectedVal); //add new list item with the selected value for this DD
this.rawValue = selectedVal; //now force it to select the value again.

----- form1.#subform[0].TryDD::preOpen - (JavaScript, client) --------------------------------------

var preSelecteVal = this.rawValue;           //save the value incase it is being selected already
this.clearItems();                           //clear all the options
var stringList = TryDDBackUp.rawValue;       //get the constructed value from initilize event code
stringList = stringList.split("***");        //split the value to multiple list options

                                             //start loading list options
var listItem;                                //variable to hold temp values for each itration
for (i=1;i<stringList.length;i++) {
                                      //xfa.host.messageBox(stringList[i])
listItem = stringList[i];
listItem = listItem.split("~");      //prepare the display text and related value to load in to options list
this.addItem(listItem[0], listItem[1])
}

this.rawValue = preSelecteVal;               //load previously selected value if any