cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
m_wllms
Level: Powered On

How to Trigger Field Validation Error Messages on Multi-Page Forms

I have created a three page SharePoint list form that has all but three fields as required. However, when I try to submit the the form with some fields being empty, it does not alert the user that the field is empty and the form is still submitted. Currently, I have a save button at the end of the form with the following code used OnSelect:

 

Patch('Contingent Worker Onboarding',Defaults('Contingent Worker Onboarding'),CWInfo_Form.Updates,JobInfo_Form.Updates,OtherCompany_Form.Updates)

Ideally I would like for it to set off the Error notifications that are trigged by default when using OnSubmit as shown below. Right now it I can only get this to work using the default Save button in SharePoint and it only works for the first page.

 

 

sampleerror.png

 

 

 

 

 

 

 

 

 

 

 

 

I've tried searching online but I cannot find any good examples/best practices on how to accomplish this efficiently. Everything I found shows how to use Patch on a Multi-page form but not how to manage validations. I also, have the following questions:

 

1. Would it be better to validate the fields after the entire form is filled out? Or would it be best to validate these fields when they click on the next button before they go to the next page?

2. Since my fields are required when I use Patch should I explicitly add every field in order for the validation to work or should continue to use what I am using (see code above).

3. I noticed when I use my custom save button to submit, when the user goes back to view/edit the form all but the first form fields are blank eventhough in the SharePoint list they all have values. How can I fix this?

 

Here are screenshot of my form for more information:

 

All the required fields are set on the List level and on the PowerApps form

 

Columns.png

 

SharePoint Integration Settings.

 

SharePointIntegration.png

 

First Page of the Form

 

Screen: CWInfo

Form: CWInfo_Form

 

 

Next Button OnSelect

NewForm(JobInfo_Form); Navigate(JobInfo,ScreenTransition.Fade)

 

 

Second Page of Form

Screen: JobInfo

Form: JobInfo_Form

 

JobInfo.png

 

Next Button OnSelect

NewForm(OtherCompany_Form); Navigate OtherCompany,ScreenTransition.Fade)

 

 

Third Page of Form

Screen: OtherCompany

Form: OtherCompany_Form

 

 

 

Save Button (Same as Above):

Patch('Contingent Worker Onboarding',Defaults('Contingent Worker Onboarding'),CWInfo_Form.Updates,JobInfo_Form.Updates,OtherCompany_Form.Updates)

 

Any advice would be greatly appreciated!

12 REPLIES 12
Community Support Team
Community Support Team

Re: How to Trigger Field Validation Error Messages on Multi-Page Forms

Hi @m_wllms,

 

Multiple forms submit is only available using patch.

But using the formula you provided, it will not work.

Patch('Contingent Worker Onboarding',
Defaults('Contingent Worker Onboarding'),
CWInfo_Form.Updates,
JobInfo_Form.Updates,
OtherCompany_Form.Updates)

The formula avove, for the record being submitted, only the last records data would be kept (OtherCompany_Form.Updates), the other two would be overwrite by blank value if the data has not been provided in the last records.

Besides, all three form.updates should contain the required field.

 

To workaround your scenario, you may need to build single control for each field, and then take use of patch to submit all the required field.

Adding a thread for your reference:

Multiple form submit

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
m_wllms
Level: Powered On

Re: How to Trigger Field Validation Error Messages on Multi-Page Forms

Hi @v-micsh-msft,

 

Thank you for taking the time to help me. I have a question about the workaround you suggested. I am not sure what you mean by "build single control for each field". Have I not done that already in my form? Currently, I have a control for each of the required fields in the form. Is there something I am not understanding?

Gargoolgala
Level 8

Re: How to Trigger Field Validation Error Messages on Multi-Page Forms

Hi - did you get this sorted out? I have a very similiar problem

m_wllms
Level: Powered On

Re: How to Trigger Field Validation Error Messages on Multi-Page Forms

No, unfortunately I didn't. I ended up having to create custom validation for each field. I used this to help me:

 

https://powerapps.microsoft.com/en-us/blog/validation/

abd3127
Level 8

Re: How to Trigger Field Validation Error Messages on Multi-Page Forms

Hello @Gargoolgala@m_wllms@v-micsh-msft

 

Did u get any answer on how we can apply validations when using multiple forms??

Can u give me an idea how did u use custom validations? I mean did u apply "isBlank" on every control?

seadude
Level 10

Re: How to Trigger Field Validation Error Messages on Multi-Page Forms

You might creating a single-screen app and controlling the form fields with Visibility instead of having 3 separate screens. I recently did this with an 80+ field form and it works great.

abd3127
Level 8

Re: How to Trigger Field Validation Error Messages on Multi-Page Forms

@seadude

Thanks for the suggestion.

But we can not change this structure as it is client demand.

seadude
Level 10

Re: How to Trigger Field Validation Error Messages on Multi-Page Forms

You could build the app where they never know its a single screen. I use tabs to make it look multi-screen. Click "Next" button or another tab and visibility of form fields changes. Looks like they're going to another screen but their not. If a field on (fake) screen 1 was not filled in, show a popup. When they click "OK", change visibility back to (fake) screen 1 with built-in validation showing the field that was missed.

 

Could be lot of rework for you though. Just an idea 🙂

 

Good luck!

richcoresln
Level: Powered On

Re: How to Trigger Field Validation Error Messages on Multi-Page Forms

I also discovered this problem when trying to achieve something similar.

Quite surprised that this does not exist already.

However, having the following on a screens "Next" buttons "OnSelect" function seems to work:

 

If(!Form1.Valid, SubmitForm(Form1), Navigate(CustomFormScreen2));

If there is a cleaner way to achieve this I'd be interested in knowing what it is.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,140)