Power Apps Combo Box Validation [With Various Examples]

Are you looking forward to learning to make a Power Apps Combo box mandatory? In this Power Apps tutorial,  I will discuss everything related to Power Apps Combo Box Validation.

In addition, we’ll look at how to limit the Power Apps Combo box to two choices. Users who choose more than two values will receive an error message stating, “Maximum of two selections allowed.”

Lastly, I will cover how to validate other Power Apps fields based on the Combo box selection.

Power Apps Combo Box Validation

This section will explain how to make the Power Apps Combo box mandatory.

For Example, I have a SharePoint Online list [IT Service Request] that has various columns like:

Column NameData Type
Employee IDTitle
Employee NameSingle line of text
IssueChoice [“Laptop,” “Network,” “Other” , “Outlook”]
Power Apps Combo box validation

I created a Power Apps Canvas app and added an Edit form connected to the above SharePoint list. The form contains the Combo box control. I want to make the Combo box [Issue] mandatory.

Whenever the user doesn’t select any value from the Combo box, he/she will get the warning message [Required], as shown below:

How to make Power Apps Combo box mandatory

Let’s see how to achieve this:

  • Open Power Apps, create a Blank canvas app -> Connect the SharePoint list to the app.
Make Power Apps Combo box mandatory
  • Insert an Edit form -> Then, add a new data source for the above SharePoint list, and set the Edit form’s Data source property:
DataSource = 'IT Service Request'

Where,

  1. IT Service Request = SharePoint List Name
Power Apps Combo box mandatory
  • Select the Issue DataCard -> Set its Required property as true, as shown below:
Make Combo box mandatory in Power Apps
  • Then, select the Combo box and set its OnChange property to the code below.
If(
    IsBlank(DataCardValue3.Selected.Value),
    UpdateContext({ErrorMessage: true}),
    UpdateContext({ErrorMessage: false})
)

Where,

  1. DataCardValue3 = Combo box control name
  2. ErrorMessage = Context variable name
Power Apps ComboBox throws entry is required validation error on EditForm SharePoint
  • Now, select the ErrorMessageLabel and set its Text and Visible properties as shown below:
Text = "Required"

Visibility = ErrorMessage
Validating if Power Apps Combo Box are empty
  • Once your app is ready, Save, Publish, and Preview the app. Whenever the user opens the Power Apps form, it will make the Combo box control required and notify the error message until any value is selected in the Combo box.
Validating for Power Apps Combo Box

This is how we can make the Power Apps Combo box mandatory.

How to limit a Power Apps Combo box to 2 Selection

Here, I will explain how we can limit the Power Apps Combobox to 2 selections.

For Example, I have created a Power Apps Canvas app and then added a Combo box control that contains the “Loan Type” [Which I added manually].

Users who select more than two values will receive an error notification as “Maximum 2 selections Allowed“. Then, the combo box will automatically remove the selected value(s) from the combo box.

Combo box validation in Power Apps

Follow the below steps to achieve this:

  • On the Power Apps screen, insert a Combo box control -> Set its Items property to:
["Home Loan", "Car Loan", "Gold Loan", "Personal Loan"]

Refer to the image below:

Limit the Power Apps Combo box to 2 Selection
  • Select the Combo box -> Set its OnChange property to:
Set(
    varValidation,
    FirstN(
        Self.SelectedItems,
        2
    )
);
If(
    CountRows(Self.SelectedItems) > 2,
    Reset(Self);
    Notify(
        "Max 2 selections allowed",
        NotificationType.Error,
        3000
    )
)

Where,

  1. varValidation = Provide the variable name
How to limit the Power Apps Combo box to 2 Selection
  • Once your app is ready, Save, Publish, and Preview the app. Whenever the user selects more than two values, they will receive an error notification as “Maximum of 2 selections allowed“.
Power Apps Combo box selected items limit

This is how we can limit the Power Apps Combobox to 2 selections.

Validate other Power Apps fields based on the Combo box selection

In this section, I will show you how we can validate the other Power Apps fields based on the selected value of the Combo box.

For Example, I have a SharePoint Online list [Branch Login Details] that has various columns like:

Column NameData Type
BranchesTitle
PasswordSingle line of text
How to validate other Power Apps fields based on Combo box selected value

I created a Power Apps Canvas app and added an Edit form connected to the above SharePoint list. The form contains the Combo box control, Text-input control, and Button control.

Whenever the user selects a value from the combo box [Department], the password text input should be similar to the selection made from the combo box.

If the user enters an incorrect password and selects a different value from the combo box, clicking the button control will trigger an error notification as “Your password is incorrect” as shown below:

Validate other Power Apps fields based on Combo box selected value

Follow the below steps to achieve this:

  • On the Power Apps screen -> Insert an Edit form -> Then, add the SharePoint list data source connector, and set the Edit form’s Data source property as:
DataSource = 'Branch Login Details'

Where,

  1. Branch Login Details = SharePoint List Name
Validating the other Power Apps fields based on Combo box selected value
  • Insert a Button control -> Set its OnSelect property to the code below:
If(
    !IsBlank(
        LookUp(
            'Branch Login Details',
            Title = cmb_Department.Selected.Value And Password = txt_Password.Text
        ).Title
    ),
    Navigate(Screen3),
    UpdateContext({ShowForgotMessage: true})
);
If(
    !IsBlank(
        LookUp(
            'Branch Login Details',
            Title = cmb_Department.Selected.Value And Password = txt_Password.Text
        ).Title
    ),
    Navigate(Screen3),
    Notify(
        "Your Password is Incorrect",
        NotificationType.Error,
        3000
    )
);

Where,

  1. Branch Login Details = SharePoint list name
  2. Title = SharePoint list title column
  3. cmb_Department = Combo box control name
  4. Password = SharePoint list column name
  5. txt_Password = Text-input control name
Validate Power Apps Combo Box
  • Once your app is ready, Save, Publish, and Preview the app. When the user enters an incorrect password and selects a different value from the combo box, clicking the button control will trigger an error notification as “Your password is incorrect.”
How to validate other fields based on Combo box selected value in Power Apps

This is how we can validate the other Power Apps fields based on the selected value of the Combo box.

Conclusion

I hope I have provided the complete information about Power Apps Combo box validation with different scenarios:

  1. How to make the Power Apps Combo box mandatory?
  2. Limit the Power Apps Combobox to 2 selections.
  3. How do we validate the other fields based on the selected value of the Combo box?

Also, you may like some more Power Apps tutorials: