Displaying and selecting blank or null values in drop down and combo box controls
Many a time we would like to have an option wherein user can select a blank value in dropdown or combo control in power apps, also at times, we would like to reset the control to a blank value.
In this blog post, I will describe a simple method using which we can enable blank value selection in the drop-down or combo control and also reset the control to blank value whenever we select to do the same.
Enabling blank selection on the dropdown control power apps
Step 1: Open power apps home page and click on create to start creating a power app from blank.
Step 2: After you click on the create button you will be taken to power app studio wherein you can customize the app and add functionality to the same.
Herein add a dropdown control on to the power app screen and enter below value in the items property of the control.
Step 3: Add an icon on the screen and set the on-select property of the icon to the below code so that whenever we click on the icon it will reset the dropdown control.
Whenever we select the icon in power apps it will reset the dropdown to the default value provided for the same.
You can check the default value for control by selecting the control and checking the properties for the same and the right pane.
Step 4: On the control properties pane, remove the default value for the drop-down control, now when you click on the reset icon you will still be able to see the first value on the control this is because we have not enabled the null value selection for the same.
Step 5: For enabling the null value selection for the control, on the right-hand side pane click on advanced. This will show properties such as onselect, onreset, and other elements.
Under the data section click on more options to see additional properties related to the control, here you will be able to see the option "Allow Empty Selection" this will be set to false by default.
Set this property to true, once you do this save the power apps and try running the application now when you click on the reset button the dropdown control will be set to blank.
We will see enabling blank value selection on a combo box in the next blog post.