Trying To Populate a Text Box with Export Values from Multiple Selections from a Dropdown List Box
Hello,
I am trying to poplulate a textbox with the export values from multiple selections from a Dropdown List Box. For example, my dropdown list box may have:
Item Value/Export Value:
Posting Journal Entries to General Ledger/F_GL_POST
Budget Adjustment Entry/F_BD_ENTRY
etc.
I want the user to pick from the descriptive terms (the Item Value in the Dropdown list), but have the more technical description (the Export Value) poplulate in the text box. The user picks as many Item Values as they need one at a time. If they pick one they don't need, they pick it again and it is removed from their selections. I found a DOCUMENT LEVEL script online that works for this EXCEPT that it provides the Item Values rather than the Export Values. I need the Export Values in the text box, not the Item Values.
Here is the script:
function fillRoles(doc, fieldName, newValue)
{
var ar = [];
// Get the value(s) currently stored in the dropdown value and
// convert them to an array
var v = doc.getField(fieldName).value;
if (v.length > 0) {
var ar = v.split(",");
}
// Do we already have newValue in the array?
var foundIt = -1;
for (var i=0; i<ar.length; i++) {
if (ar[i] == newValue) {
foundIt = i;
break;
}
}
if (foundIt != -1) {
// remove the item
ar.splice(i, 1);
}
else { // add the item at the end
ar.push(newValue);
}
// convert the array to a string
this.getField(fieldName).value = ar.join();
}After I added the document level script, I added the following code to the dropdown list on the Validate tab under the 'Run Custom validation script':
fillRoles(this, "textbox name here", event.value);I am trying to figure out what I need to change to display the export values rather than the Item values.
Thank you.
