Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

Power Apps Form Validations: 9 Useful Examples

I developed an Event Registration application in Power Apps a few days before. There, users need to submit their details in the form to create a new account. To avoid duplicate data and collect valid information from the user, we were required to apply validations on the Power Apps forms.

In this article, I will explain how to validate the fields in the Power Apps form before submission.

How to Validate a Power Apps Form Before Submission

Here, I will explain how to apply validations for the fields preset in the Power Apps form, like full name, email, phone number, etc. These validations will help fetch valid information from the users and avoid duplicate data.

powerapps validate form before submitting

Here, I have a SharePoint list named Event Registration Form, which stores the data entered in the Power Apps form.

power apps form validation

This list has the following columns, along with data types.

Column NameData Type
User IDTitle
Full NameSingle line of text
PasswordSingle line of text
Email AddressSingle line of text
Phone NumberSingle line of text
AgeNumber
DepartmentChoice(IT, HR, Marketing,Sales)
Job TitleSingle line of text
Company NameSingle line of text
Registration DateDate & Time
CommentsMultiple lines of text
Before implementing the validations, add the above SharePoint list to the Power Apps application. Then, Add an Edit form control and provide the above list name as its Data Sorce.
powerapps validate form before submit

Let’s see the validations for Power Apps form data validation example-wise!

Power Apps Full Name Field Validation

Look at the example below; on the full name, if I’m trying to provide special characters or numbers, an error message will be displayed. The border color of the full name field was also changed to red.

power apps form name field validation

Follow the steps below to achieve this!

1. Provide the below formula in the OnChange property of the Full Name field in the Power Apps form.

If(
    IsBlank(Self.Text),
    UpdateContext({IsFirstNameInvalid: false}),
    UpdateContext(
        {
            IsFirstNameInvalid: !IsMatch(
                Self.Text,
                "^[a-zA-Z\s]+$"
            )
        }
    )
)

Here, IsFirstNameInvalid is the local variable name.

  • It holds boolean values; if the current field(Self.text) is blank, the value is false.
  • If the text contains any special characters or numbers, then it holds true value.
powerapps form validation error message

2. Provide the below code on the full name fields Border Color property!

If(
    IsBlank(FullName_value.Text),
    Parent.BorderColor,  
    If(
        IsFirstNameInvalid,  
        RGBA(168, 0, 0, 1), 
        Parent.BorderColor   
    )
)

Here, FullName_value is the control name; like above, we can also take Self.Text.

  • If the control is blank, then the parent border color will apply.
  • if IsFirstNameInvalid value is true then reg color(RGBA(168, 0, 0, 1)) will be apply.
  • Otherwise, the parent border color only applies.
powerapps form validation on submit

3. Provide the below codes on the given proper