cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NigelP
Kudo Kingpin
Kudo Kingpin

Restrict Combobox to only entries in the Items Property

Hi

 

Is it possible to restrict the results of a Combox to the entries in the Item Property ?

 

AT the moment it looks as if I can put in any rubbish into a combo box.

 

There appears to be no validation as what is typed in..

 

Thanks

 

Nigel

1 ACCEPTED SOLUTION

Accepted Solutions

Hi@NigelP,

Do you mean that it is allowed to entry empty in your Combo Box?

Let me summarize:

1). Empty search text is allowed for Combo Box

2). When something invalid like characters not in the Items property, the Combo Box should restrict it

3). Some validation message should pop up to remind users

To achieve the above needs, try as below.

1. Add a Label 

set the Text as follows:

"Invalid entry, please entry within the Items!"

set the Visible as follows:

If(!(ComboBox5.SearchText in ["","Lead 1","Lead 2","Lead 3"]),true,false)

2. If you have a form to submit Combo Box selected, you could add a validation to the OnSelect of the submit button as below:

If(Label9.Visible=true,
   Notify("Your entry is not invalid, please entry something existing in the Item!",NotificationType.Error),
   SubmitForm)

Please check if the above formula works.

Regards,

Qi

View solution in original post

5 REPLIES 5
v-qiaqi-msft
Community Support
Community Support

Hi@NigelP,

Based on the issue that you mentioned, do you want to force users to enter only specific content based on the Items property?

Could you please tell me how you set the Items property of the Combobox?

Please try the formula set for the OnChange property of the Combo Box:

If(
    !IsBlank(ComboBox1.SearchText) && !(ComboBox1.SearchText in [YourItemsFormula]),
    Notify(
        "Your entry is not invalid, please entry something existing in the Item!",
        NotificationType.Error
    ) && Reset(ComboBox1)
)

Hope it could help you.

Regards,

Qi

 

Hi @v-qiaqi-msft 

 

Thanks for this - I will try.

 

Items is just ["","Lead 1","Lead 2","Lead 3" ,etc ]

 

Regards

 

Nigel

Hi @v-qiaqi-msft 

 

The Onchange event does not fire if you just enter text.

 

Regards

 

Nigel

Hi@NigelP,

Do you mean that it is allowed to entry empty in your Combo Box?

Let me summarize:

1). Empty search text is allowed for Combo Box

2). When something invalid like characters not in the Items property, the Combo Box should restrict it

3). Some validation message should pop up to remind users

To achieve the above needs, try as below.

1. Add a Label 

set the Text as follows:

"Invalid entry, please entry within the Items!"

set the Visible as follows:

If(!(ComboBox5.SearchText in ["","Lead 1","Lead 2","Lead 3"]),true,false)

2. If you have a form to submit Combo Box selected, you could add a validation to the OnSelect of the submit button as below:

If(Label9.Visible=true,
   Notify("Your entry is not invalid, please entry something existing in the Item!",NotificationType.Error),
   SubmitForm)

Please check if the above formula works.

Regards,

Qi

View solution in original post

Hi @v-qiaqi-msft 

 

Thanks - That worked.

 

Regards

 

Nigel

 

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (58,626)