Hi,
In Power Apps, I have five choice options in a field pulled from SharePoint and I only want to allow two to be selected at a time. How can I accomplish this?
Here is the filed I use which displays the five choices:
Choices([@'Form'].Which_x0020_of_x0020_the_x0020_f)
Solved! Go to Solution.
Combo box controls have no mechanism to limit the number of choices.
But I think add an Error Message under the Combobox to remind users to only select two choices at a time if selecting more than 2 choices.
Set ErrorMessage Label Text:
If(CountRows(DataCardValue31.SelectedItems)<>2,"You must Only select 2 choices",Parent.Error)
Set Submit button DisplayMode:
If(CountRows(DataCardValue31.SelectedItems)=2, DisplayMode.Edit, DisplayMode.Disabled)
And set Default of box:
If(CountRows(DataCardValue31.SelectedItems)=2, CountRows(DataCardValue31.SelectedItems))
then if the user selects more than 2 choices, it will show the error message, and the submit button will be disabled, and the Box doesn't show the default value.
Sik
Do you mean you want the dropdown only list two options?
Please try this:
Filter(Choices([@'Form'].Which_x0020_of_x0020_the_x0020_f), Value="Option1" || Value="Option2")
Sik
Hi, sort of, I want all five options to show, however I only want the user to be able to select two at a time. Doesn't matter which two, just has to be two.
How about this, I have a text box where it populates a number when a selection is made, so if I select 2 the number will increment to 2 and so on. How would I validate the field? If the count of the file is greater than 2 then block save and show error message.
This is the code in the "default" box for the field that counts the number of selections:
CountRows(DataCardValue31.SelectedItems)
Combo box controls have no mechanism to limit the number of choices.
But I think add an Error Message under the Combobox to remind users to only select two choices at a time if selecting more than 2 choices.
Set ErrorMessage Label Text:
If(CountRows(DataCardValue31.SelectedItems)<>2,"You must Only select 2 choices",Parent.Error)
Set Submit button DisplayMode:
If(CountRows(DataCardValue31.SelectedItems)=2, DisplayMode.Edit, DisplayMode.Disabled)
And set Default of box:
If(CountRows(DataCardValue31.SelectedItems)=2, CountRows(DataCardValue31.SelectedItems))
then if the user selects more than 2 choices, it will show the error message, and the submit button will be disabled, and the Box doesn't show the default value.
Sik
The solution works, however this is a SharePoint form so there is not "submit" button. There is only the save button that is part of the SharePoint site form. Any way to disable save using the same method outlined?
User | Count |
---|---|
196 | |
124 | |
87 | |
49 | |
42 |
User | Count |
---|---|
284 | |
163 | |
138 | |
75 | |
72 |