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.
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
SharePoint Integration Settings.
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
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!
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:
Regards,
Michael
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?
Hi - did you get this sorted out? I have a very similiar problem
No, unfortunately I didn't. I ended up having to create custom validation for each field. I used this to help me:
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?
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.
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!
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.
User | Count |
---|---|
122 | |
87 | |
86 | |
75 | |
67 |
User | Count |
---|---|
214 | |
181 | |
137 | |
96 | |
83 |