Skip to main content
December 11, 2023
Question

A checkbox component [label=""] has an invalid value for "value". All selected values must be present in the choiceValues array,

  • December 11, 2023
  • 1 reply
  • 1 view

Hi

I am getting this error for checkbox

Expression evaluation error [evaluation ID = IGMIN] in rule 'gai_managegeneraladdnlinfo' at function a!checkboxField [line 19]: A checkbox component [label=""] has an invalid value for "value". All selected values must be present in the choiceValues array, but value was false and choiceValues was true.

ri!projectInfo.column is boolean type where i am saving this value

how can i fix this?

i have attached my code

 a!checkboxField(
                    choiceLabels: " Check here if you are a non-profit organization",
                    choiceValues: true(),
                    value: ri!projectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{3f6f4ef6-3667-485b-86f3-6519b03d80a2}isNonProfit'],
                    saveInto: ri!projectInfo['recordType!{ba1b9bf5-818d-401c-b540-67788e6d7d2d}GAI Application Project Info.fields.{3f6f4ef6-3667-485b-86f3-6519b03d80a2}isNonProfit']
                  )

1 reply

davidg426798
December 11, 2023

The problem is that your checkbox only knows how to handle true (checked) or null (unchecked), but not false. I typically do something like this:

value: if(
    ri![field],
    ri![field],
    null
  ),
saveinto: a!save(
    target: ri![field],
    value: a!defaultValue(save!value,false)
  )
)

This puts true and false into the record, while still displaying only the single checkbox.