cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
karlosch
Frequent Visitor

Combobox clear content when not visible

Have 2 comboboxes:

Combo Box 1: Yes, No, N/A

Combo Box 2: dropdown of a few options (Hidden and only visible when CB1 ="No")

 

If the user selects "No" and selects something in the 2nd combobox how do i make it so that if the user goes back to Combo Box 1 and selects "Yes" that the content of combobox 2 clears? 


At the moment it is writing it to sharepoint even though it was hidden. 


Thanks!  

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @karlosch ,

Firstly, you should use the Self.Selected.Value if you are referring to the control value OnChange. Also the Visible property of your second combo box can simply be DataCardValue46.Selected.Value=“No”.

However these are not  necessary to address the issue as the syntax I have given you is certainly valid providing all the control and output names are valid - you are simply resetting a control to its Default value. What is the error you are getting?

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @karlosch ,

You obviously already have something on the OnChange of the first combo to unhide the second one. If you add

If(

   Self.Selected.Value=“Yes”,

   Reset(ComboBox2Name)

)

It will put the value of this back to the Default.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Thanks, im getting the below error. (also i didnt already have anything in "OnChange" the visibility of ComboBox 2 is simply  If(DataCardValue46.Selected.Value="No",true,false)

karlosch_0-1606726389605.png

 

Hi @karlosch ,

Firstly, you should use the Self.Selected.Value if you are referring to the control value OnChange. Also the Visible property of your second combo box can simply be DataCardValue46.Selected.Value=“No”.

However these are not  necessary to address the issue as the syntax I have given you is certainly valid providing all the control and output names are valid - you are simply resetting a control to its Default value. What is the error you are getting?

Thanks heaps, this worked! If(Self.Selected.Value= "Yes" ,Reset(DataCardValue43)) 

 

Do you know how this can be applied to a toggle? Trying to say, if toggle is unchecked, then reset x datacard

 

thanks! 

Hi @karlosch ,

For a toggle actioning on unchecked - you would put this OnChange

If(
   Self.Value= False,
   Reset(DataCardValue43)
) 

or possibly

If(
   !Self.Value,
   Reset(DataCardValue43)
) 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,021)