Hi,
I have a dropdownfield in the edit screen. Initially when I open existing record, by that time this field will not having any data and based on the user search in another field, this dropdown will load the data.
When I try to set ChoiceValue to null it is not accepting. Can some one guide me how to handle this when there is no data in initial load.
Thanks
ERROR:
Discussion posts and replies are publicly visible
The choice labels and choice values must have data. The dropdown component automatically displays the label for the 'value' field if that value appears in the choiceValues parameter. Try removing the if statement.
"by that time this field will not having any data and based on the user search in another field"Then its not a good interface design. Try to use a showWhen condition or unfiltered values as choicevalues or choicelabel. For the showWhen condition you can set a isnull evaluation - show when its not null.
Thanks for your suggestion.
Thanks so much for your advice. I have tried to remove the if statement but it does not work at all.
growdle
Simplest way to handle nulls in dropdownField, is to provide some value to the placeholder parameter, look at the following it works!!!
a!dropdownField( placeholder: "-- Select Some Options -- " )
Which is not helping for a choicevalue array element which is a null value. :)
Hello,
For the component, Choice Labels must be present, and an equal number of values must coincide with those labels. If you do not have data on load, the component will throw this error. Therefore, I would suggest utilizing the visibility parameter "showWhen" to check if you have data for these fields, if you do - then you can display the component. If you do not, then you should hide the component.