Data Verification for Power Apps Forms

Data Verification for Power Apps Forms

Data Verification for Power Apps Forms!

Overview:

This blog post delves into the intricacies of data verification for Power Apps forms. By exploring validations for text fields, date pickers, and dropdowns, readers are equipped with practical code snippets to ensure data integrity and user feedback. Additionally, it provides a visual guide on error indications, enhancing user experience.

Data Validation For Power Apps Forms

  • Open your power app and select your  
  • Form data cards and unlock all data  
  • Cards by clicking the lock icon of your form
Unlocking all data cards of the form to perform data verification in PowerApps

Set up Validation for the text Field:

  • Data Validation for text field 
  • Use this code on the bordercolor  
  • Property and hoverbordercolor of text field 
				
					If(IsBlank(DataCardValue1.Text),Color.DarkRed, Parent.BorderColor) 
				
			

Here is the result of this !

Whenever the text field is blank the border color and hover border color remain red  

And when the user enters any data in the text field the color of the border and hover changes to the parent 

Date Picker Validation:

Click on the date picker control inside the data card. 

Under the “OnSelect” or “OnChange” property, you can add a formula to ensure the date is within a certain range 

Use this code: 

				
					If(DateValue4.SelectedDate > Today(), Notify("The date cannot be in the future", NotificationType.Error)) 

 
				
			
Date picker validation from if formula

When the user selects the passed date it will show an error notification  

Error view when user select passed date

Dropdown Validation:

Click on the dropdown control inside the data card 

Under the “OnChange” property, you can add a formula to ensure a valid option is selected: 

Use this code 

				
					If(Dropdown1.Selected.Value ="Started", Notify("You have selected a valid option",NotificationType.Success),Notify("You have selected a valid option",NotificationType.Error)) 
				
			
Data Verification for Power Apps Forms Dropdown Validation

It will show an error massage if selected option from dropdown is not “started” 

It will show success massge if selected option from dropdown is “Started” 

Data Validation show success massge

Display Error Message:

Now we USE cancel icon and CHECK icon adjust them Infront of our each DataCard 

We use them to show error when a wrong data entered  

We use this code in icon property of  icon 

				
					If(IsBlank(DataCardValue1.Text),Icon.Cancel, Icon.Check ) 
				
			

And use this code for fill color 

				
					If(Self.Icon=Icon.Cancel, Color.DarkRed ,Color.DarkGreen) 
				
			

Or when any data field is blank  

These icon’s are visible any of text field is blank and or  

Passed date is selected in date picker 

Data Validation Passed date is selected in date picker

When each field is filled with correct data  icon checks  are visible  

Filled with correct data then icon

Now validate phone number and email address formats 

We use this code on the icon property of the icon

				
					If( IsMatch(DataCardValue1_2.Text,Match.Email), Icon.Check,Icon.Cancel) 
				
			

Here ‘@’ is missing so its  showing error 

Now add the missing sign ‘@’ 

Now add the missing sign ‘@’

Now phone number validation  

We use this code for phone number validation 

Icon property of icon  

				
					If( 

    IsMatch( 

        DataCardValue1_1.Text, 

        Match.Digit&Match.Digit&Match.Digit&"-"& 

        Match.Digit&Match.Digit&Match.Digit&"-"& 

        Match.Digit&Match.Digit&Match.Digit&Match.Digit 

    ),Icon.Check,Icon.Cancel) 
				
			
Adding the code for phone number validation

Here  is the result when we enter wrong format phone  

When we enter the wrong format phone 

When we enters correct formate  

When we enters correct format

Conclusion:

Ensuring data integrity in Power Apps forms is vital for any application. Through strategic use of code and visual cues, users can now seamlessly understand and rectify their input errors, leading to improved data accuracy and enhanced user experience.

If you want to learn more about the Power Apps, feel free to explore our other informative articles and tutorials.

Have additional inquiries? Our team is here to assist. Please don’t hesitate to reach out!

Enhanced Support Widget