Forum Discussion
john john
Oct 21, 2023Steel Contributor
Remove/Clear the selected value from a combobox upon changing the value of another combobox
I have 2 combo boxes named; Street & Location. now I want to clear the selected value of the Location combo box when the Street combo box is changed? how I can do so? I do not want to reset the value i want to clear it. so it woks on Edit as well as on New forms
- wfrf92Copper Contributor
1. Select your Street combo box in the Power Apps studio.
2. Go to the "OnChange" property of the Street combo box and enter the following formula:
Reset(Location)
This formula will clear the selected value in the Location combo box when the Street combo box is changed.
3. If you want this to work for both new and edit forms, you can wrap the `Reset` function with an If statement that checks if the form is in edit mode.
For example:
If(EditForm.Mode = FormMode.New, Reset(Location))
This formula will clear the Location combo box only if the form is in the new mode. If it's in edit mode, the Location combo box won't be cleared.
4. Make sure you replace "EditForm" with the actual name of your edit form. You can do this by selecting your form and checking its properties.
Now, when you change the Street combo box in your form, it will clear the selected value in the Location combo box, but only in the new form. The edit form will not be affected.- CWSAutomationCopper Contributor
john john You are correct. Did you find a resolution to this using the modern combobox? It doesn't have the same properties as the classic version. Quite annoying. Once a value is selected, I cannot unselect it or clear the selections.