Skip to main content
Participating Frequently
Jul 29, 2025 2:50 PM UTC
Solved

Getting error : A dropdown component [label="Is Under Header"] has an invalid value for "value". All selected values must be present in the choiceValues array, but value was

Hi Everyone,

I 'm getting above error for the below code.

a!dropdownField(
label: "Is Under Header",
placeholder: "Select",
/*required: ri!questions[ri!index].questionType<>cons!RIDCO_QUESTION_TYPES[11],*/
disabled: index(
ri!questions[ri!index],
"questionType",
{}
) = cons!RIDCO_QUESTION_TYPES[11],
choiceLabels: touniformstring(local!headerQuestions),
choiceValues: touniformstring(local!headerQuestions),
value : touniformstring(index(index(ri!tempQuestions,ri!index,""),"parentQuestionText",{})),

local!headerQuestions : returns list of text string

    shubhama926776
    Brainy
    Jul 29, 2025 6:27 PM UTC

    Error occurs because your valuefrom parentQuestionText doesn't exist in choiceValues from local!headerQuestions.
    Fix it by adding a contains() check:

    value: if(
      contains(
        touniformstring(local!headerQuestions),
        touniformstring(index(index(ri!tempQuestions,ri!index,""),"parentQuestionText",{}))
      ),
      touniformstring(index(index(ri!tempQuestions,ri!index,""),"parentQuestionText",{})),
      null
    )


    This validates the value exists before setting it, otherwise uses null.

    शुभम्

    4 replies

    shubhama926776
    Brainy
    Jul 29, 2025 6:27 PM UTC

    Error occurs because your valuefrom parentQuestionText doesn't exist in choiceValues from local!headerQuestions.
    Fix it by adding a contains() check:

    value: if(
      contains(
        touniformstring(local!headerQuestions),
        touniformstring(index(index(ri!tempQuestions,ri!index,""),"parentQuestionText",{}))
      ),
      touniformstring(index(index(ri!tempQuestions,ri!index,""),"parentQuestionText",{})),
      null
    )


    This validates the value exists before setting it, otherwise uses null.

    शुभम्
    Participating Frequently
    Jul 30, 2025 6:17 AM UTC

    This works for me Thank you so much

    stefanhelzle0001
    Brainy
    Jul 29, 2025 6:34 PM UTC

    This exact question is already discussed a thousand times here. I suggest to use the search function.

    harshas2775
    Brainy
    Jul 30, 2025 6:13 AM UTC
    index(index(ri!tempQuestions,ri!index,""),"parentQuestionText",{})

    The output of this expression should be present in the choiceValues and should be singular. So check the output and handle the values not present in choiceValues with null in the 'value' configuration. 

    Happy to help. Even happier to optimize.