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
Mike Schmitt Soma
Discussion posts and replies are publicly visible
I solve such situations by checking that all the values are contained in the list of choiceValues before assigning them to the field.
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
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.
can you please suggest by coding how can I do it that you mentioned to null it out or show an error validation:
" you can either null it out, or force that value into the dropdown selections and have the dropdown component show an error validation. "
appian.user said:can you please suggest by coding
I don't have time to assemble a working example at the moment (but if i get a chance i can look into it soon) - but in short, you need to learn to write manual code that prepares the necessary on-form local variables to allow you to do this. For instance, you would query the default choices into an initial local variable. Then you would declare another local variable that you will use to actually populate the choices, except in that local variable you check whether or not the existing options include all current selections (including any that may have been deleted), and if so, append those values to the set.