PowerApps Sharepoint Online List Field Validation

In this post I will show how you can add validation to your form fields that you created using Powerapps and Shareppoint online list.

Lets customize the Sharepoint online list using Powerapps.

We will turn the field RED if some one entered the special characters such as @, !,# etc, only characters allowed are below:

  • A-Z
  • a-z
  • 0-9
  • -_

Go to PowerApps and highlight the field on which you want to ADD the validation, you will know which data card it is.

Go to advanced in the properties of datacard, add a regular expression below in BorderColor attribute.

If(IsBlank(Parent.Error) And IsMatch(DataCardValue3.Text,”[A-Za-z0-9_-]+”),Parent.BorderColor,Color.Red)

This formula is saying that field should not be blank and should not contain any Character outside of what are mentioned in the formula.

[A-Za-z0-9_-]+

This will add the color only validation but what if we want that form should not be submitted if user entered the wrong value i.e. special characters.

This can be achieved by using the regular expression in submit button advanced properties, under action –> OnSelect attribute.

Formula:

If(IsMatch(DataCardValue3.Text,”[A-Za-z0-9_-]+”),SubmitForm(SharePointForm1) And Navigate(Screen1, ScreenTransition.None))

This will only submit and transition to other screen if DataCardValue3  value matches the characters [A-Za-z0-9_-]+

Now try to submit the form with wrong value, field will turn red as well as submit button will not work.

I hope this small post will assist you if you have the similar requirement.

 

Tech Wizard

http://techwizard.cloud

 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s