In this article, we will be working on different examples of PowerApps data validation such as required field, number, Email, Phone, Age, Date, URL, Password, Number and ZIP Code.
4.1 Implement required field validation
4.2 Name Field validation
4.3 Age Field validation
4.4 Email Address Field validation
4.5 Phone Number Field validation
4.6 Numeric Field validation using IsNumeric function
4.7 Zip Code Field validation
PowerApps Data validation checks whether the value of a single column or a complete record is valid for a data source.
Data Validation within apps and business forms is critical to prevent errors, and to ensure data transactions occur without errors and uncomfortable bottlenecks during submission.
To implement data validation in PowerApps, we need to first unlock 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.
Regular expressions can be used in PowerApps to achieve text input validation, PowerApps provides three types of functions for text validation: IsMatch, Match, and/or MatchAll
IsMatch – This function gives you a Boolean (true/false) answer of whether or not some string of text matches a certain pattern.
Match – Let’s you know what in the string of text matches a certain pattern, such as finding an email address somewhere in a text box and letting you know what the email address is.
MatchAll – Let’s you know all matches of a certain string or pattern within another string.
To showcase PowerApps data validation examples, we will create a PowerApps app from a SharePoint Online list and then we will implement the validations.
Step 1: In the Modern SharePoint Online Site, Create a SharePoint List as “Doctor Directory App”. We will work on a SharePoint list with below columns:

Step 2: Create an app for the above created SharePoint List.
Step 3: Provide a name for the new app to get Started and Press on Create Button



PowerApps Data Validation
Now we will be implementing data validation in above newly created app.
Step 1: Select the card
Step 2: From the advanced properties choose to unlock to change properties

Step 3: On the Required property of the card change it to be true
In the below screenshot, you can see there will be an Asterisks mark (*) in the Specialist field. This means that a specific field is mandatory to fill by the user.

Step 1: Select the Doctor Name field Data Card and unlock it.
Step 2: Insert an Icon in the Doctor Name textbox.
Step 3: Write below code in the Icon property of the Icon.

Icon Property
Step 4: Write below code in the Icon property of the Color.

Color Property
Step 5: Write below code in the Icon property of the Tooltip

Note: You can add an error message to the user either on a label or on the tooltip property of the icon, but I used tooltip icon property as shown below.

When the field is blank the icon will be the X icon with the color red otherwise the icon will be the check icon with green color because written ‘Doctor Name’ text input field as shown below.

PowerApps Name Validation
Step 1: Select the Age field Data Card and unlock it.
Step 2: Insert an Icon in the Age textbox.
Step 3: Make the Format property to be number to allow only digits.
Step 4: Use the same method to create an Icon for ‘Age’ as was shown for ‘Doctor Name’ but change the logical expression in the Icon property to this instead.

Icon Property
Step 5: Write below code in the Icon property of the Color.

Color Property
Step 6: Write below code in the Icon property of the Tooltip

Tooltip Property
Note: You can add an error message to the user either on a label or on the tooltip property of the icon, but I used tooltip icon property as shown below.

When the field is blank the icon will be the X icon with the color red otherwise the icon will be the check icon with green color because written ‘Age’ text input field as shown below.

PowerApps Age Validation
An email address must be in the format Doctorname@companyname.com
Step 1: Select the Doctor Email Address Field Data Card and unlock it
Step 2: Insert an Icon in the Doctor Email Address textbox
Step 3: There is a predefined matching pattern already exists for email addresses. Use this code in the Icon property of the icon for ‘Doctor Email Address’.

Icon Property
Step 4: Write below code in the Icon property of the Color.

Color Property
Step 5: Write below code in the Icon property of the Tooltip

Tooltip Property
Note: You can add an error message to the user either on a label or on the tooltip property of the icon, but I used tooltip icon property as shown below.

When the field is blank the icon will be the X icon with the color red otherwise the icon will be the check icon with green color because written ‘Doctor Email Address’ text input field as shown below.

PowerApps Email Validation
Phone numbers must be entered in the format ###-###-####.
Step 1: Select the Phone number Field Data Card and unlock it.
Step 2: Insert an Icon in the Phone number textbox.
Step 3: Make the Format property to be number to allow only digits.
Step 4: Write this code in the Icon property of the Icon.


Icon Property
Step 5: Write this code in the Icon property of the Color.

Color Property
Step 6: Write this code in the Icon property of the Tooltip.


Tooltip Property
Note: You can add an error message to the user either on a label or on the tooltip property of the icon, but I used tooltip icon property as shown below.

When the field is blank the icon will be the X icon with the color red otherwise the icon will be the check icon with green color because written ‘Phone Number’ text input field as shown below.

PowerApps Phone Number Validation
As like previous Number field validation example, I will take the same Phone Number field with the Cancel icon.
Step 1: Write this code in the Icon property of the Icon.


Icon Property
Step 2: Write below code in the Icon property of the Color.

Color Property
Step 3: Write below code in the Icon property of the Tooltip.

Tooltip Property
Note: You can add an error message to the user either on a label or on the tooltip property of the icon, but I used tooltip icon property as shown below.

When the field is blank the icon will be the X icon with the color red otherwise the icon will be the check icon with green color because written ‘Phone Number’ text input field as shown below.

PowerApps Phone Number Field Validation Using Is Numeric Function
PowerApps Zip code validation is like the Phone Number field validation.
Step 1: Select the Zip code Field Data Card and unlock it.
Step 2: Insert an icon in the Zip code textbox.
Step 3: Make the format property to allow only digits.
Step 4: Write below code in the Icon property of the Icon.


Icon Property
Step 5: Write below code in the Icon property of the Color.

Color Property
Step 6: Write below code in the Icon property of the Tooltip.


Tooltip Property
Note: You can add an error message to the user either on a label or on the tooltip property of the icon, but I used tooltip icon property as shown below.

When the field is blank the icon will be the X icon with the color red otherwise the icon will be the check icon with green color because written ‘Phone Number’ text input field as shown below.

Power Apps zip code Validation


Display Mode Property
=======
Plus read