Customize Forms Using PowerApps: Validation Issues

Brass Contributor

The "special type of PowerApps app" (see Customize a SharePoint list form using PowerApps) used for in-place list forms seems to suffer from two serious validation issues.

 

1. List validation information is not communicated to form user.  Where

  1. The SharePoint list column has a validation formula and user message,
  2. invalid data is entered for that column in the custom form, and
  3. the form's Save button is clicked

the form's behavior is to show the progress indicator for saving, but not to save and not display any error message.  In the best case, the form would discover from SharePoint that the updated column's value was invalid and display the user error message provided by SharePoint for that column.  Even a generic message that flagged the updated column value as invalid would be helpful.

 

2. Updated column values are seemingly not available in form data elements during the editing process.  To see this, do as follows.  In a custom PowerApps form, make the error display element for any datacard visible and assign as its Text value the value of the column data for that element. For example, suppose the list has a column named "Email" exposed on the form through the "Email_DataCard" with an error display element called "EmailErrorMessage". Reference Email in the Text property of EmailErrorMessage and make EmailErrorMessage visible.

 

Set_element_error_display_to_element.PNG

 

 

 

Run the form for an existing record. EmailErrorMessage will show the current value of Email. Change the current value. This change will not be reflected in the EmailErrorMessage, even after focus moves off the Email textbox.

 

Non-updating_PowerApps_form_element.PNG

 

 

 

 

 

 

 

 

If these issues are based on a misunderstanding of expected behavior of the form, please explain.  As it stands, these issues seem to severely limit the ability to perform column validation in custom PowerApps forms.

 

7 Replies

I am having the same issue - any update on this?

 

Thanks

Microsoft never resolved this issue, even after I reported a likely cause to them.  Please see if the work-around below resolves this issue for you.  I'd really like to know (a) if this pertains to your situation and (b) if it does, what the result is of using it.  

-----------

I've now identified the likely cause of this issue.  It can be stated as follows:  When there are validation formulas on non-required columns, the columns are treated as required.  More specifically, it appears that some process executes column validation formulas against empty strings.

 

The first image below shows the symptom of this:  all required columns have valid data, but two optional columns with SharePoint validation formulas, Mobile Number and Email, do not.  PowerApps displays a non-specific error message, seemingly about Entry Date.

 

The second image below shows what happens when Quick Edit is used to attempt to add a new record.  This time, probably because the process is within SharePoint, the column validation error message for Mobile Number displays, even though the column is optional and no data has been entered.

 

To essentially prove that this is the issue, I modified the validation formulas for both Mobile Number and Email, adding an or ISBLANK(<column name>) to each.  The revised formulas are:

 

  • Mobile Number: =OR(AND(LEN([Mobile Number])=12,IF(LEFT([Mobile Number],2)="+1",TRUE,FALSE),IF(ISNUMBER(RIGHT([Mobile Number],10)+0),TRUE,FALSE)),ISBLANK([Mobile Number]))
  • Email: =OR(AND(ISERROR(FIND("
     ",Email,1)),IF(ISERROR(FIND("@",Email,2)),FALSE,AND(ISERROR(FIND("@",Email,FIND("@",Email,2)+1)),IF(ISERROR(FIND(".",Email,FIND("@",Email,2)+2)),FALSE,FIND(".",Email,FIND("@",Email,2)+2)<LEN(Email))))),ISBLANK(Email))

With the revised formulas I was able to save a new record with only the required columns having data.

 

PowerApps_SharePoint_validation1.pngPowerApps_SharePoint_validation2.png

I have a URL column and it is not a required field.   It works fine when user does not enter the value.   However, it the user enters text (not a URL), it does not save and it does not give an error message.  It seems that it is validating if the string is a URL field but does not display the error message. 

According to Types of fields and field data types, a URL field is just a text field with URL formatting and a rule that text entered that doesn't begin with "http://" (or "https://") will have "http://" prepended to it.  

 

What if you add validation in PowerApps that requires a valid URL?  In other words, what if you make sure that only syntactically valid URLs are entered before a save action can be performed?

Issues is not displaying the error message on the validation - when I click on save, it shows dots to save but there is no action.  When I go and enter valid url, it saves the form.  Did you have issues displaying the error messages for the field validation?

In my case, PowerApps/SharePoint applied validation to an optional field when it was blank and failed to save.  It also failed to display the error message associated with the field.  The validation that created this problem was in SharePoint.  I resolved this problem by adding a clause to the SharePoint validation to accept an empty string. 

 

I did not have a problem with not showing an error message for an invalid field where the validation was in PowerApps.

 

I'm on vacation this week so may not be able to respond further until next Monday.

My experience with data validation is that it will act as a field requirement (without the messaging specifying as much) unless you specify that blanks are also acceptable.