There are several ways to get this done. One choice is dependent upon how you bind the data from the table to the drop-down. Typically form developers populate the listed items but they do not specify item values on the Binding tab.
If so 'Specify Item Values' you can separate the values display in the drop-down and the value you actually want to process. In the example, I added the SAP codes as values.
In the drop-down exit event I added added two options for getting the value.
form1.page1.subform1.sapCode.rawValue = this.getSaveItem(this.selectedIndex);
var selectedText = this.rawValue;
form1.page1.subform1.parsedValue.rawValue = selectedText.substring(0,4);
The first option uses the object model to extract the value. However, if you do not explicitly bind the value items when you get the data from SAP, this option is not available.
The second option simply parses the code value from the raw text, assuming the code is always 4 digits.
GetDropDownValue.pdf 78.1 K
thanks for your answer.
In fact my dropdownlist is binded with an SAP table which contains SAP material type and description.
The first solution is not good for me because I don't want to put "hard value" in the adobe form.
I tried your code but it doesn't work. I think I don't do it properly.
More details :
-> in the data view I have the table TT023T - DATA - ( MATKL, WGBEZ)
-> in the hierarchy I have the dropdownlist : form_corp2.sform_corp.MATKL
In the Object tab, Binding, I don't know what I have to put in the default binding and in the link Specify item values.
For the moment I have : $record.TT023T.DATA[*].MATKL in the default binding and
in the dynamic properties :
items : $record.TT023T.DATA[*]
text : WGBEZ
value : MATKL
But with this, I have only the WGBEZ in the dropdownlist value list.
I want to concatenate "MATKL - WGBEZ" in the dropdownlist value list.
The last solution is to have directly from SAP table the concatenation in a field and bind it to the item text but I would like to try with the script.