Skip to main content
October 28, 2024
Question

All selected value must be present in the choiceValues array, but value was 2;4 and choiceValues was 4;3

  • October 28, 2024
  • 7 replies
  • 0 views

hi team.

I have a requirement as:

I have to create data using some dropdown values and after creation of that data user can delete that data from where that drop data is coming and once data is deleted from frontend then

when user tries to edit that created data then error throws as:

since value of that dropdown is deleted by the user then while editing how to handle this error

please suggest any answer 

[mention:b45a4f6a20b14a008e4e0ec732a8bf98:e9ed411860ed4f2ba0265705b8793d05]  [mention:57fc948ec4c44d7fbda6e5509555d197:e9ed411860ed4f2ba0265705b8793d05] 

    7 replies

    stefanhelzle0001
    October 28, 2024

    I solve such situations by checking that all the values are contained in the list of choiceValues before assigning them to the field.

    October 28, 2024

    can you please elaborate ?

    actually while selecting from dropdown data exist that is why data is visible in dropdown but once user delete the drop down data then when editing this dropdown error throws as that dropdown is deleted 

    mikes0011
    Brainy
    October 28, 2024

    upon initially loading the form, you need to check whether any of the pre-filled dropdown items have a current value that violates the available choices for the dropdown.  that's as simple as checking the local variable that will hold the dropdown choices to see whether it contains the selected value or not.  then if the pre-loaded value setting is observed to contain a value not among the valid choices, you can either null it out, or force that value into the dropdown selections and have the dropdown component show an error validation.