PowerApps Validation: 9 Examples [Required Field, Email, Date, URL, Password, Number, ZIP]

In this PowerApps tutorial, we discuss 9 PowerApps validation examples. How to implement validations in PowerApps form or App.

PowerApps validation examples are:

  • How to implement required field validation in PowerApps
  • Validate Number field in PowerApps
  • How to validate numeric field using IsNumeric function in PowerApps
  • How to validate email address in PowerApps
  • How to validate Date field validation in PowerApps
  • Zip code validation in PowerApps
  • Validate URL in PowerApps
  • How to implement password validations in PowerApps
  • PowerApps Temperature field validation

PowerApps Validation Examples

Now, we will check a few PowerApps validation examples, like the required field, zip code, date, URL, Password, number, email, etc.

1# Required field validation in PowerApps

Now, we will see how to implement required field validation in PowerApps.

We will create a PowerApps app from a SharePoint Online list and then we will implement the validation.

In the SharePoint Online Site, Create a SharePoint List as “Event Registration Details”. This SharePoint list is having some columns like First Name, Organization, Employee ID, Email Address, Mobile Number, Zip Code, etc as shown below.

powerapps validation

To use the PowerApps validation, you need to create an app for this SharePoint List. Go to PowerApps tab -> Click on Create an app as shown below.

power apps validation

Provide a Name for the new app to get started and click on Create button.

powerapps required field validation

This Apps contains the below three of the screens:

  • Browse Screen: This screen will help you to browse one or more item that displays to the user. Also, it will help you to Refresh, Sort, and Add a new item to the screen.
  • Detail Screen: This screen will help you to display all the details or information of a specific item.
  • Edit Screen: This screen will help you to edit or modify a specific item and will save that change.
power apps required field validation

In this App, we will implement the validation in the Edit Screen.

Below is how the Edit screen looks like below, which will be having all the fields.

validation in powerapps
PowerApps validation

Unlock the Power Apps Data Card Value

To implement validation in PowerApps, we need to first unlock the Data card value.

First of all, Unlock all the Data Card value and then rename the fields that you want. To unlock the Data Card, Select one data card -> go to Advanced tab -> Click on the Lock icon as shown below.

validation in power apps
implement required field validation in PowerApps

PowerApps Field Required as True or False

In the below screenshot, you can see there will be an Asterisks mark (*) in the First Name field. This means that a specific field is mandatory to fill by the user.

To do this field as required, Select that specific Data card -> Apply this below formula:

Required = true

You can do this thing with other fields that you want to display as mandatory.

powerapps mandatory field validation
PowerApps required field validation

2# PowerApps Number Field Validation

Are you trying to validate the numeric field in PowerApps? This PowerApps validation example shows how to validate a numeric field in PowerApps.

  • Select the Number field Data Card and Unlock it.
  • If you want to make this Number field as mandatory, then make it required as True (As I have explained in the above example).
  • Add any Warning or lock icon (Insert -> Icons -> Warning/Lock) beside the Number Label input as shown below.
powerapps number field validation
PowerApps number field validation
  • Select the Warning icon and apply the below formula in the icon formula bar as:
Icon = If(
    IsMatch(
        DataCardValue16.Text,
        Digit & Digit & Digit & Digit & Digit & Digit & Digit & Digit & Digit & Digit
    ),
    Check,
    Icon.Warning
)

Where,

  • Icon = Property Name of the icon
  • IsMatch = Match function name
  • DataCardValue16 = Mobile Number text field name (As it is a Data card, so the name is DataCardValue. Instead of Data card, you can use the Text box and it should be “YourTextBoxName.Text“).
  • Digit & Digit(s) = It means the Number field should contain only the Digit or Number value. Excepting any digit or number value, it will not accept any value like Alphabet, Special Character, etc. As there is 10 number of digits, so it will allow only up to 10 digits.
  • Check = If the formula condition is true, then it will put a checkmark icon instead of a Warning icon.
  • Icon.Warning = If the formula condition is false, then it will show the same Warning icon.

Once you applied the formula in the formula bar, just click on Format text that presents under the formula bar.

powerapps numeric field validation
powerapps numeric field validation

Change the Color of Number field Validation Icon

If you want to change the color of the Validation icon, then apply this below formula on its icon Color Property as:

Color = If(
    IsMatch(
        DataCardValue16.Text,
        Digit & Digit & Digit & Digit & Digit & Digit & Digit & Digit & Digit & Digit
    ),
    Green,
    Red
)

Where,

  • Color = Icon Property Name
  • Green = If the following condition is true, then the icon will become a checkmark icon with Green color.
  • Red = If the following condition is false, then the icon will remain the Warning icon with Red color.

Once you applied the formula in the formula bar, just click on Format text that presents under the formula bar.

Power apps number validation
powerapps number field validation

Preview the Edit Screen and Test the Number Field PowerApps Validation

When you will Preview (by using F5 or Run icon) the Edit screen and enter the digits (Upto 10 digits only) into the Number field, then the warning icon will automatically convert into the checkmark icon (with green color) as shown below.

powerapps number validation
powerapps numeric field validation

3# PowerApps Number Field Validation using IsNumeric function

PowerApps IsNumeric function helps to test whether the value is numeric or not. The return value of this IsNumeric function is a Boolean value i.e. true or false.

Syntax:

IsNumeric( Value )

Where,
Value = Specify the value to test.

Example:

As like previous Number field validation example, I will take the same Mobile Number field with the Warning icon.

Select the Warning icon and apply the below formula on its Icon property as:

Icon = If(
    IsNumeric(DataCardValue16.Text),
    Check,
    Icon.Warning
)

Where,

  • IsNumeric= This function specifies whether the value is numeric or not.
  • DataCardValue16 = Mobile Number text field name (As it is a Data card, So the name is DataCardValue).
  • Check = If the formula condition is true, then it will put a checkmark icon instead of a Warning icon. That means, it checks whether the user is entering a numeric value or not.
  • Icon.Warning = If the formula condition is false, then it will show the same Warning icon.
powerapps isnumeric function

Similarly, if you want to change the color of the Number field validation icon, then apply this below formula on its icon Color Property as:

Color = If(
    IsNumeric(DataCardValue16.Text),
    Green,
    Red
)

Refer the below screenshot:

powerapps isnumeric functions

Preview the Edit Screen and Test the Number Field PowerApps Validation

When you will Preview (F5) the Edit screen and enter the digits into the Number field, then the warning icon will automatically convert into the checkmark icon (with green color) as shown below.

IsNumeric function powerApps

4# PowerApps Email Validation

Lot of time we need to validate email id in PowerApps, now, let us see another PowerApps validation example, validate email in PowerApps.

  • Select the Email Address field Data Card and Unlock it.
  • If you want to make this Data Card as mandatory, then make it required as True otherwise False.
  • Add any Warning or Lock icon (Insert -> Icons -> Warning/Lock) beside the Email Label input as the previous one (Number Field Validation).
  • Select the Warning icon and apply the below formula in the icon formula bar as:
Icon = If(
    IsMatch(
        DataCardValue15.Text,
        Email
    ),
    Check,
    Icon.Warning
)

Where,

  • Icon = Property Name of the icon
  • IsMatch = Match function name
  • DataCardValue165= Email Address text field name (As it is a Data card, so the name is DataCardValue. Instead of Data card, you can use the Text box and it should be “YourTextBoxName.Text“).
  • Email = The name “Email” contains the format of an Email Address as “xyz@gmail.com”. If you will not enter the proper format of the Email address, then it will not accept in the Email field.
  • Check = If the formula condition is true, then it will put a checkmark icon instead of a Warning icon.
  • Icon.Warning = If the formula condition is false, then it will show the same Warning icon.

When you applied the formula in the formula bar, just click on Format text that presents under the formula bar.

powerapps email field validation
powerapps email validation

Change the Color of Email field Validation Icon

If you want to change the color of the Email validation icon, then apply this below formula on its icon Color Property as:

Color = If(
    IsMatch(
        DataCardValue15.Text,
        Email
    ),
    Green,
    Red
)

Where,

  • Color = Icon Property Name
  • Green = If the above condition is true, then the icon will become a checkmark icon with Green color.
  • Red = If the above condition is false, then the icon will remain the Warning icon with Red color.

Preview the Edit Screen and Test the Email Field Validation

When you will Preview (by using F5 or Run icon) the Edit screen and enter the proper format of the email address (Preeti@gmail.com) into the field, then the warning icon will automatically convert into the checkmark icon (with green color) as shown below.

Powerapps email field validation
Validate email in PowerApps

5# PowerApps Date Validation

Now, we will see another PowerApps validation, how to validate a date field in PowerApps.

  • Select the Date field Data Card and Unlock it.
  • If you want to make this Data Card as mandatory, then make it required as True otherwise False.
  • Select the Date field Data card and apply the below formula on its BorderColor property as:
BorderColor = If(DataCardVaue25.SelectedDate < Today(), Red, RGBA(0, 18, 107, 1))
  • BorderColor = Date Picker field Property Name
  • DataCardValue25 = Date picker input field
Powerapps date validation
  • Now take a Label input (Insert -> Label) under the Date field and apply the below formula on its Visible property as:
Visible = DataCardValue25.SelectedDate < Today()

Where,

  • Visible = Label Property Name
  • DataCardValue25 = Date picker input field
Power apps date validation
How to validate date field in PowerApps
  • Similarly, Put a notification message in the Label Text Property as:
Text = "Date Cannot be in the Past!! Please select a Valid Date"
Power apps date field validation
  • Now take a Button (Insert -> Button) and rename it to Submit as shown below. Apply the below formula on its DisplayMode property as:
DisplayMode = If(DataCardValue25.SelectedDate < Today(), DisplayMode.Disabled, DisplayMode.Edit)
Powerapps date field validation
PowerApps validation: Date field

Preview the Edit Screen and Test the Date Field Validation

When you will Preview (by using F5 or Run icon) the Edit screen and select the Past date from today, then an invalid notification will appear as “Date Cannot be in the Past!! Please select a Valid Date” and also the Submit button will be in disable mode.

But when you will select Today’s date as well as any future date, then the Submit button will enable as shown in below screenshot.

date validation in powerapps
PowerApps date validation

6# PowerApps Zip Code Validation

PowerApps Zip code validation is similar to the Number field validation in PowerApps.

Let us see how to zip code validation in PowerApps:

  • Select the ZipCode field Data Card and Unlock it.
  • If you want to make this Data Card as mandatory, then make it required as True otherwise False.
  • Add any Warning or Lock icon (Insert -> Icons -> Warning/Lock) beside the Zip Code Label input as the previous one.
  • Select the Warning icon and apply the below formula in the icon formula bar as:
Icon = If(
    IsMatch(
        DataCardValue20.Text,
        Digit & Digit & Digit & Digit & Digit & Digit
    ),
    Check,
    Icon.Warning
)

Where,

  • Icon = Icon Property Name
  • IsMatch = Match function name
  • DataCardValue20 = Zip Code text field name
  • Digit & Digit(s) = It means the Number field should contain only the Digit or Number value. Excepting any digit or number value, it will not accept any value like Alphabet, Special Character, etc. As there is 6 number of digits, so it will allow only up to 6 digits.
  • Check = If the formula condition is true, then it will put a checkmark icon instead of a Warning icon.
  • Icon.Warning = If the formula condition is false, then it will show the same Warning icon.

Just click on the Format text that presents under the formula bar.

Powerapps Zip code validation
Zip code validation in PowerApps

Change the Color of Zip Code field Validation Icon

If you want to change the color of the Zip Code validation icon, then apply this below formula on its icon Color Property as:

Color = If(
    IsMatch(
        DataCardValue20.Text,
        Digit & Digit & Digit & Digit & Digit & Digit
    ),
    Green,
    Red
)

Where,

  • Color = Icon Property Name
  • Green = If the above condition is true, then the icon will become a checkmark icon with Green color.
  • Red = If the above condition is false, then the icon will remain the Warning icon with Red color.

Preview the Edit Screen and Test the Zip Code Field Validation

When you will Preview (by using F5 or Run icon) the Edit screen and enter the digits (Upto 6 digits only) into the Number field, then the warning icon will automatically convert into the checkmark icon (with green color) as shown below.

Power apps zip code validation
PowerApps validation: Zip code

7# PowerApps URL Validation

Now, we will see another PowerApps validation example, how to validate URL field in PowerApps?

To work with the Powerapps URL field Validation, we need to do these below things:

  • Select the URL field Data Card and Unlock it.
  • If you want to make this Data Card as mandatory, then make it required as True otherwise False.
  • Add any Warning or Lock icon (Insert -> Icons -> Warning/Lock) beside the URL text Label input as the previous one.
  • Select the Warning icon and apply the below formula in the icon formula bar as:
Icon = If(
    IsMatch(
        DataCardValue19.Text,
        "http://twitter.com/",
        BeginsWith
    ) || IsMatch(
        DataCardValue19.Text,
        "https://twitter.com/",
        BeginsWith
    ),
    Check,
    Icon.Warning
)

Where,

  • Icon = Icon Property Name
  • IsMatch = Match function name
  • DataCardValue19 = Url text field name
  • “http://twitter.com/” || “https://twitter.com/” = This means the URL Field should start with either http://twitter.com/ or https://twitter.com/, then only the field will accept the value.
  • Check = If the formula condition is true, then it will put a checkmark icon instead of a Warning icon.
  • Icon.Warning = If the formula condition is false, then it will show the same Warning icon.

Just click on the Format text that presents under the formula bar.

Powerapps URL Validation
URL field validation in PowerApps

Change the Color of URL field Validation Icon

If you want to change the color of the URL field validation icon, then apply this below formula on its icon Color Property as:

Color = If(
    IsMatch(
        DataCardValue19.Text,
        "http://twitter.com/",
        BeginsWith
    ) || IsMatch(
        DataCardValue19.Text,
        "https://twitter.com/",
        BeginsWith
    ),
    Green,
    Red
)

Where,

  • Color = Icon Property Name
  • Green = If the above condition is true, then the icon will become a checkmark icon with Green color.
  • Red = If the above condition is false, then the icon will remain the Warning icon with Red color.

Preview the Edit Screen and Test the Twitter Profile URL Field Validation

When you will Preview (by using F5 or Run icon) the Edit screen and enter the proper format of the Twitter URL (either “http://twitter.com/” or “https://twitter.com/”) into the URL field, then the warning icon will automatically convert into the checkmark icon (with green color) as shown below.

power apps URL Validation
PowerApps validation: URL field

8# Validate Password field in PowerApps

To work with the Powerapps Password Validation, we need to do these below things:

  • Select the Password field Data Card and Unlock it.
  • If you want to make this Data Card as mandatory, then make it required as True otherwise False.
  • Add a Lock icon (Insert -> Icons -> Lock) beside the Password text Label input as the previous one.
  • Select the Lock icon and apply the below formula in the icon formula bar as:
Icon = If(
    IsMatch(
        DataCardValue22.Text,
        "(?!^[0-9]\*$)(?!^[a-zA-Z]\*$)([a-zA-Z0-9]{8,10})"
    ),
    Check,
    Icon.Lock
)
  • Icon = Icon Property Name
  • IsMatch = Match function name
  • DataCardValue22 = Password text field name
  • “(?!^[0-9]\*$)(?!^[a-zA-Z]\*$)([a-zA-Z0-9]{8,10})” = It validates a strong password which can contain eight, nine or 10 characters with the addition of at least one digit and at least one alphabetic character. Although, it does not contain any special characters.
  • Check = If the formula condition is true, then it will put a checkmark icon instead of a Lock icon.
  • Icon.Lock = If the formula condition is false, then it will show the same Lock icon.

Just click on the Format text that presents under the formula bar.

Poweerapps Password validation
PowerApps validation: Passeord field

Change the Color of Password field Validation Icon

If you want to change the color of the Password field validation icon, then apply this below formula on its icon Color Property as:

Color = If(
    IsMatch(
        DataCardValue22.Text,
        "(?!^[0-9]\*$)(?!^[a-zA-Z]\*$)([a-zA-Z0-9]{8,10})"
    ),
    Green,
    Red
)

Preview the Edit Screen and Test the Password Field Validation

When you will Preview (by using F5 or Run icon) the Edit screen and enter the password with alphabet and digit, then only it will unlock and put a checkmark with green color.

Power apps password validation

Change the Powerapps Password Mode

In the above test, you can see the Password is visible to everyone which it should not be. The password must be in the form of hidden mode as nobody can see it.

For this purpose, we need to change the textbox as Password mode in the Powerapps form.

Select the Password text label input/Data card -> Go to Properties tab -> Select Password option in the Mode section as shown below.

password validation in powerapps

9# PowerApps Temperature field Validation

Now, we will see how to validate a Temperature field in the Power Apps form and how to validate the Temperature field with an integer value and as well as with a Centigrade value (C) in PowerApps.

Here, I have a SharePoint List named “Access Registers“. This list has some columns with different data types. Among all the columns, It has a Temperature column (Check Your Temperature) with a single line of the text data type.

In the below screenshot, you can see all the different types of columns that are present in the SharePoint List (Access Registers).

validate temperature field in powerapps

I have created a Canvas Powerapps app where I have used this Temperature field in an Edit Form.

Basically, the Edit form is having all the SharePoint list fields including the Temperature field. By using this form, the user will enter all the field values and submit the form. Once it is submitted, then the item will save in the SharePoint List.

The Powerapps Edit form looks like the below screenshot:

validate temperature field in powerapps
PowerApps temperature field validation

In this example, I want to validate the Temperature field within a limited range value (maybe the temperature range between 34 to 40).

That means the Temperature field value will be restricted only with an integer value or integer value including the Centigrade (C) i.e. 34C to 40C.

If the user will enter out of the range value, then a warning notification message will appear in the Powerapps form.

Validate Temperature with an Integer Value

To validate the Temperature field with an integer value, follow these below things:

From the Powerapps Edit form, Select the Temperature field data card and apply the below formula on its OnChange property as:

OnChange = If(Value(DataCardValue4.Text)<34 Or Value(DataCardValue4.Text)>40,
Notify("The Temperature Should be between 34C to 40C"))

Here,

DataCardValue4 = Temperature field Data card name

In this above formula, I have taken the Temperaure range from 34 to 40C, it means, the temperature field will not only take the value as like 34, 35, 36 etc. But also, it will take the value in decimal as like 35.6, 38.7, 40.0 etc.

You can refer the below screenshot:

how to validate temperature field in powerapps

This above formula specifies, If the temperature value does not satisfy with the condition (within range in between 34 to 40), then a warning notification will appear on the top of the form.

Validate Temperature field Specifying with Color

In the temperature field, If you want to fill color the Textbox as a warning, then apply the below formula on its Color property as:

Color = If(Value(DataCardValue4.Text)<34 Or Value(DataCardValue4.Text)>40,Red,Green)

Refer the below screenshot:

how to validate temperature field in power apps

The above formula specifies, If the temperature value is satisfying with the condition (within range in between 34 to 40), then the temperature value will display with Green color otherwise, it will be Red color.

Preview the Power Apps app

Save and preview the app (by using F5). Go to the temperature field and enter a value range between 34 to 40C (Suppose 35.7), then you can see the field value will appear (With Green color) as like below:

how to validate temperature value in power apps

Suppose, If you have entered the temperature field value that exceeds the given range, then you will see the temperature field value will be in Red color and you will get a warning notification message as like below:

how to validate temperature value in powerapps

NOTE:

The body temperature value may appear in Farhenhite (F) as well as in Centigrade (C). If you want to apply the Farhenhite value in the above formula, then you can take a range from 98F to 105F. Similarly, If you want to apply the Centigrade value, then take the range from 34C to 40C.

Validate Temperature with Integer Value including Centigrade (C)

Suppose you want to validate the Temperature field with integer value including Centigrade (C).

This means the temperature value should allow 34C to 40C i.e in Centigrade in two decimal places and you can enter the value as 35.1C, 38.5C, 40.3C (including C), etc.

Follow these below things to do so:

In the same way as like previous, Select the Temperature field data card and apply the below formula on its OnChange property as:

OnChange = If(Value(Substitute(DataCardValue4.Text,"C",""))<34 Or
Value(Substitute(DataCardValue4.Text,"C",""))>40,
Notify("The Temperature Should be between 34C to 40C"))

Here,

DataCardValue4 = Temperature field Data card name

You can refer the below screenshot:

validate temperature field value in power apps

This above formula specifies, If the temperature value does not match with the condition (within range in between 34C to 40C), then a warning notification will appear on the top of the form.

Fill the Temperature value with color

In the same way, If you want to fill color to the temperature Textbox as a warning, then apply the below formula on its Color property as:

Color = If(Value(Substitute(DataCardValue4.Text,"C",""))<34 Or
Value(Substitute(DataCardValue4.Text,"C",""))>40,Red,Green)

Refer the below screenshot:

validate temperature field value in powerapps

The above formula specifies, If the temperature value is satisfying with the condition (within range in between 34C to 40C), then the temperature value will display with Green color otherwise, it will be Red color.

Like the same way as the previous example, you can save and preview the app (F5). If you will enter the temperature field value range between 34C to 40C, then you can see the field value will appear (With Green color) otherwise it will be in Red color including a warning notification.

Also, you may like these below Powerapps tutorials:

In this PowerApps tutorial, we checked various PowerApps validations:

  • How to validate PowerApps Number field
  • How to validate numeric field using IsNumeric function in PowerApps
  • Implement required field validation in PowerApps
  • Validate Email in PowerApps
  • PowerApps Date Validation
  • How to validate Zip Code in PowerApps
  • Validate a URL field in PowerApps
  • PowerApps Password Validation
  • How to Validate Temperature field in PowerApps
  • Hello, is there anyway you know to validate based on a prefix within the entry (aka input must start with 1Q), but the number of digits or letters after the prefix can vary so they can’t be hard coded?

  • >