Author Details

avatar-teacher

Evolvous

We are a team of tech enthusiast and this section is where we love to share our experience and our knowledge. We try our best to help you understand technical topics by giving you live instances of how-to’s, guides, tips, FAQ’s and troubleshoots.

If you like it or have questions, do share your feedback in the comments section below.

Data Validation using PowerApps: How to do validation in PowerApps?

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. 

Table of Contents 

  1. What is PowerApps data validation?
     
  2. Why do we need PowerApps data validation?
     
  3. How to validate text input in PowerApps?
     
  4. PowerApps data validation examples:
     

               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

1. What is PowerApps data validation?

PowerApps Data validation checks whether the value of a single column or a complete record is valid for a data source. 

2. Why do we need PowerApps data validation? 

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. 

3. How to validate text input in PowerApps? 

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.  

4. PowerApps data validation examples: 

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: 

  • Doctor Name – Required Field 
  • Age – must be more than 25 
  • Doctor Email Address – must be in the format 
  • Phone Number – must be in the format 
  • Doctor Address – Required Field 
  • Zip code – Required Field 

Doctor Directory App - Evolvous

Step 2: Create an app for the above created SharePoint List.  

  • Go to Power Apps tab  
  • Click on Create an app as shown below.

Step 3: Provide a name for the new app to get Started and Press on Create Button

Started and Press on Create Button for PowerApps Data validation process - Evolvous

Saving to PowerApps Data Validation - Evolvous

PowerApps data validation - Evolvous

PowerApps Data Validation 

Now we will be implementing data validation in above newly created app. 

 4.1 Implement required field validation in PowerApps  

Step 1: Select the card

Step 2: From the advanced properties choose to unlock to change properties 

Implement required field validation in PowerApps

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. 

the Required property of the card change it to be true

4.2  Name field validation  

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. 

Name field validation  Data Validation process using Microsoft PowerApps - Evolvous

Icon Property

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

below code in the Icon property of the Color - Evolvous

Color Property

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

code in the Icon property of the Tooltip Using Microsoft PowerApps Data Validation - Evolvous

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.

Doctor Directory PowerApps Data Validation - Evolvous

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 - Evolvous

PowerApps Name Validation 

4.3   Age field 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 

4.4    Email Address field 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 

4.5   Phone Number Field 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

4.6   Numeric Field validation using IsNumeric function  

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 

4.7   Zip Code Field validation 

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 - Evolvous

Icon property Microsoft PowerApps Data Validation Process - Evolvous

Icon Property 

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

Colour property Microsoft PowerApps Data Validation Process - Evolvous

Color Property  

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

Tool Tip Code - Evolvous

Microsoft PowerApps Data Validation Tool tip Property Process - Evolvous

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. 

Microsoft PowerApps Data Validation Process - Evolvous

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. 

Microsoft PowerApps Data Validation Zip code Process - Evolvous

Power Apps zip code Validation  

5. Write code in the Display Mode property of the Submit icon button. 

ICon Microsoft PowerApps Data Validation Process - Evolvous

Microsoft PowerApps Data Validation Process - Evolvous

Display Mode Property 

Final Output: 

=======

Plus read

Power Script Find File Path from Network Drive