Adding an existing option to a Select Box variable via a Catalog Client Script displays an empty choice in list dropdown


Reproducible in K, not an issue in I and J.

Steps to Reproduce

1 - In a Kingston instance, open an sc_cat_item record, i.e. Access:

2 - Scroll down to 'Variables' related list and click New:
type: Select Box
question: q1
name: q1

3 - Click Save and stay at q1 Variable form

4 - Scroll down to 'Question Choices' related list and create choices as below;
text / value / order
one / one / 100
two / two / 200
three / three/ 300

5 - Go back to Access catalog item. Scroll down to 'Catalog Client Scripts' related list. Click New
type: onLoad
function onLoad() {

6 - Click Submit

7 - Go to Access catalog item once more. Click Try It from the form header section.

8 - Check the q1's options. Notice the dropdown list shows the following:


Modify the Catalog Client Script to check if the option exists in the options list before trying to add it to the list.


if (!g_form.getOption('q1', 'two')) {
    g_form.addOption('q1', 'two', 'two');

Related Problem: PRB1251363