Skip to main content
April 20, 2022
Question

dropdown

  • April 20, 2022
  • 8 replies
  • 0 views

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:

8 replies

danny.verb
April 20, 2022

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.

April 20, 2022

Thanks for your suggestion.

richardm900458
April 20, 2022

"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.

April 20, 2022

Thanks for your suggestion.

abhayd3663
February 21, 2023

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 -- "
)

richardm900458
February 22, 2023

Which is not helping for a choicevalue array element which is a null value. :)

paoloc0002
February 22, 2023

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.