Blog

SharePoint - How to fix the "skip to main content" error message on integrated forms, or to fix forms where records don't save

Why do I receive a "skip to main content" message when I attempt to save a record on a SharePoint integrated form? This post describes this problem that app builders sometimes encounter.

There's a confusing condition that can arise when app builders attempt to build SharePoint integrated forms. On the save event, the record fails to save and instead, the user sees the message "skip to main content". Alternatively, the record fails to save and no error appears whatsoever.

This post recreates this condition and describes the most common cause.

What's the cause of this error message?

In almost all cases, the cause of this problem relats to missing mandatory fields, or SharePoint server errors that are generated due to input data that fails to meet validation rules.

The reason this behaviour is confusing is because the error provides no indication that this is the cause of the issue.

Here's a forum post that highlights this issue.
https://powerusers.microsoft.com/t5/Building-Power-Apps/Sharepoint-New-Form-save-not-working/m-p/563024

Recreation of the "skip to main content" error

To recreate this issue, let's take the example of a SharePoint list of products. In this list, there are two mandatory columns - Title and Description. Let's now create a customized SharePoint form and add just one of the mandatory fields - Title.

When we attempt to create a new record through this form, we see the error message "skip to main content".

How to better identify missing data values

In practice, it can be very difficult to determine where the problem lies and which fields are missing, particularly with SharePoint lists that contain many columns.

To help identify the cause, we can display the exact error message that SharePoint reports when it fails to add or to amend a record. To do this, we can add the following formula to the OnFailure property of the form (we would substitute Product with the name of the target SharePoint list).

 

Notify(First(Errors(Product)).Message)


At run time, the form will now display a notification that indicates the missing field, rather than nothing or the meaningless "skip to main content" message.


Conclusion

When records fail to save on SharePoint integrated forms, the most likely cause is missing mandatory data, or input data that fails validation rules. We can more easily identify the cause of the problem by adding formula to the OnFailure of the form.