So, I have just made some fields in my SharePoint list to be "required", my App updated fine, didn't need to delete and add the form again.
What I would like to do now, if you do not fill in one of the required fields it leaves you on the same page and an error comes up. What I am getting now is that it navigates to the next page like I want it to but then comes up with the error.
Is there something I can add to my formula to get it to check.
I'm not sure how you have everythign setup, but it sounds like you have a button to submit the form and Navigate to another screen. Try moving your Navigate() function to the OnSuccess action in the form's advanced tab.
This way, if the fields pass validation, OnSuccess fires, and the navgation happens. If the fields fail validation, OnFailure fires, which should do nothing, provided OnFailure is set to false.
Hope this helps
I have a button on my form page that has a Patch() and Navigate().
I have looked for a OnSuccess and OnFailure in the Advanced settings of the button but cannot see either.
hi again @SteveMC
Sorry helps if you actually read the full post. I have added the OnSuccess for the form and the onfailure is set to false.
So my next problem is, even with the on success and onfailure and the required fields, it saves anyway. No error messages come up anymore.
If it's actually saving the item to your SharePoint list with the Submit() function, then it's passing the validation test on the SharePoint side.
Try refreshing your datasource (under View > Datasources, click elipsis and Refresh), then make sure the Datacards that hold the fields you want validated have their required property set to "true" (In the Datacard's Advanced tab).
Hope this helps
I am using a Patch() function on my submit button. Which works perfectly.
I am not getting errors with the app anymore like I did (the red bar across the top). There really needs to be an error of some sorts otherwise people are going to think that their incident was submitted.
Also, when all the fields required are filled in, the OnSuccess navigate does not happen. It stays on the same page, so again people are going to think that their incident has/has not been submitted.
Sorry, I missed that you were using Patch(). That won't trigger the OnSubmit action. There are a few different approaches to validate using Patch()... Again, I don't know the complexity of your app, but if you have a single form and your goal is to bring people to a "Success" page if validation passes, or keep them on the same page if validation fails, using SubmitForm() may be an approach you want to consider.
But if you need to use Patch(), There are ways to validate the form using the Validate() and Errors() function.
Okay, I am still wondering on this.
I am currently using a Patch() on my Submit form as I need to patch the person/group column.
If I use the patch() I am no longer getting any error messages about the required fields not being filled in nor is the page going to Success Page which it isn't meant to do anyway.
Does anyone know how to use validate() and error() functions. I have had a look around but not entirely sure how to get it to work with an OnSuccess on the form at the same time.
Any help would be greatly appreciated.
I don't use patch, but it looks (here) like you can validate the entire form, and check to see if the result of that validation is blank - and then only proceed if it is blank. If it's not blank, you'll get the error message from the validation.
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Features releasing from October 2019 through March 2020
Learn how to build the business apps that you need.