- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 10:21 AM
I have an OnLoad client script to set a choice list field and then set the actual value of the field.
The choices are dynamic and are first looked up (when another reference field is entered) and then stored in a field to feed the choice list.
The choice values are being correctly returned and the options in the choice list are being set. However, if a value in the field exists, when reloading the form, only the value is shown, not the display value:
Here's my client script:
function onLoad() {
//Type appropriate comment here, and begin script below
//Build Coverage Item Description Code choice list
var covCodes = g_form.getValue('coverage_code_options');
var covNum;
var currValue = g_form.getValue('coverage_item_description_code');
g_form.clearValue('coverage_item_description_code');
alert('currValue - ' + currValue);
if(covCodes == ''){
return;
}
var codeChoices = covCodes.split(',');
var i = 0;
for(i = 0; i < codeChoices.length; i++) {
covNum = codeChoices[i].split(' - ');
g_form.addOption('coverage_item_description_code', covNum[0], codeChoices[i].toString(), covNum[0]);
if(currValue == covNum[0]){
alert("into IF - " + covNum[0] + " - " + codeChoices[i].toString());
g_form.setValue('coverage_item_description_code', covNum[0], codeChoices[i].toString());
}
}
}
The alerts show me that I AM getting the correct values (5 and 5 - TOOLS in my example) but I can't get the field to show "5 - TOOLS" That should, as far as I can tell, be what line 27 does. What am I doing wrong?
TIA!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 10:35 AM
Hi,
Can you try updating line 29 as below
g_form.setValue('coverage_item_description_code', codeChoices[i].toString());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 10:29 AM
covNum[0] - should be the value and codeChoices[i].toString() should be the display value.
Open the choice list of coverage item description code and check the value of "5- tools" ( that should go in second place).
Thanks.
PS: Hit like, Helpful, Correct, if it answers your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 10:35 AM
Hi,
Can you try updating line 29 as below
g_form.setValue('coverage_item_description_code', codeChoices[i].toString());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 11:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 11:08 AM
Hi,
Thats good news. Can you please mark the answer as correct.