cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jpacettf
Level 8

Select Button to clear ComboBox Selected Data

Edit: This appears to not work as my ComboBox1 is linked to a column in a SharePoint List datasource as opposed to a manual string. If anyone knows how to do this please let me know!

 

I have a button: Button1

I have a combobox: ComboBox1

 

When I select Button1 I want whatever data has been selected in ComboBox1 to clear.

 

For Button1, I have the following on the OnSelect property: Reset(ComboBox1)

For ComboBox1, the Default property is blank.

 

This fails to reset it to blank. Am I missing something here?

11 REPLIES 11
Super User
Super User

Re: Select Button to clear ComboBox Selected Data

@jpacettf 

Try setting your DefaultSelectedItems property on the ComboBox to {}

Then when you reset the control from your button, it will remove all selected items.

 

I hope that is helpful.

Rebetcha
Level 10

Re: Select Button to clear ComboBox Selected Data

Hi @jpacettf ,

 

My guess is you use a combo box within a form or gallery?

The Reset function documentation states you can not use this function to reset a control in a gallery or edit form from outside the gallery or form. 

 

There are 2 possible sollutions:

  1. Place your button in the same data card as the combo box.
  2. Instead of using the Reset function, set the Reset property of the combo box to Button.pressed (you do not use the OnSelect of the button in this case). Clicking the button will trigger the built-in reset functionality of the combo box.
    ResetComboBox.png
jpacettf
Level 8

Re: Select Button to clear ComboBox Selected Data

@RandyHayes  Thank you, I think it was '[]' which I tried and it does work, however it then doesn't save my data.

 

The DefaultSelectedItems property on my ComboBox isn't blank, it is Parent.Default and the Card (the Parent)'s default is ThisItem.Lookup: Which refers to the column in the SharePoint list.

Super User
Super User

Re: Select Button to clear ComboBox Selected Data

@jpacettf 

So in your original post you mentioned that you just wanted to reset the combobox to blank (nothing selected).

Can you explain what you are trying to save, and when?  If you "blank" the values in the combobox, is that what you are trying to save, or is it what was originally in the combobox?

jpacettf
Level 8

Re: Select Button to clear ComboBox Selected Data

@Rebetcha Thank you, I tried both those options, unfortunately, the ComboBox does not clear.

 

ComboBox.Default = blank

ComboBox.DefaultSelectedItems = Parent.Default

 

@RandyHayes If someone wants to remove information from the ComboBox that has now changed, I wan't to to save the blank, not what was originally in the ComboBox 

Super User
Super User

Re: Select Button to clear ComboBox Selected Data

@jpacettf 

Ah...now we're getting to the root of it...

So, this is a ComboBox that is tied to a SharePoint column.  What type of column is it? A Choice column?

There are issues with setting a SharePoint column to "blank".  So, let me know what type of column it is.

jpacettf
Level 8

Re: Select Button to clear ComboBox Selected Data

@RandyHayes It's a choice column, as you say you are unable to save blank choices, so the only thing in it is "-Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I then have the Items for the ComboBox going to a LookUp Column (due to restrictions on amount of LookUp Columns you can use: ComboBox1.Items= Choices('Event Form'.PriceZoneLookup)

 

Hope this helps

Super User
Super User

Re: Select Button to clear ComboBox Selected Data

@jpacettf 

I'm a bit confused - so is this a Choice Column or a Lookup Column?

If it's a lookup Column, then if that is the only choice in the lookup column, then nothing will ever save there except "-" as that is the only valid choice for that column.

 

jpacettf
Level 8

Re: Select Button to clear ComboBox Selected Data

@RandyHayes You are able to reference a lookup column by using a Choice Column (I'm guessing this is so you are able to bypass the limit:Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

This allows my combobox to display the items in the PriceLevelDirectory. (They all display fine)

 

I am assuming it has something to do with this, why it is not working but I am unsure why. Hopefully, someone who has used this advanced method will have experienced similar issues.