cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

FormSubmit when required fields not complete

I have an app that has a form which is based on a SharePoint list. I have a button that performs the action SubmitForm:

 

     SubmitForm(FrmSelectedRequest);

 

All is fine but if the form has not been completed with all 'required' fields the form submits with an error message. How do I prevent the submit from happening if all the required fields are not complete?

3 REPLIES 3
Super User
Super User

Re: FormSubmit when required fields not complete

Hi @Anonymous,

You can can use the Display mode property of the  Submit button to do what you require.  If DataCardValue2, 6 and 9 were required, then the formula would be

If(IsBlank(DataCardValue2) || IsBlank(DataCardValue6) || IsBlank(DataCardValue9), Disabled, Edit)

 Then unless there was data in those three controls, the user could not successfully activate the Submit button.

As an alternative, you could also hide the Submit button by putting a similar formula into its OnVisible property.  In this case, all three values would have to hold data for the formula to reduce to true and Unhide the button.

!IsBlank(DataCardValue2) && !IsBlank(DataCardValue6) && !IsBlank(DataCardValue9)

 If this answers your question, please mark the thread as solved.

Anonymous
Not applicable

Re: FormSubmit when required fields not complete

Thank you. I can see that this will work but if the form has lots of fields the formula looks very clunky. I don't understand the purpose of the "Required" property if you can still submit the form when such fields are empty.
Dawidvh
Level 10

Re: FormSubmit when required fields not complete

Hi @Anonymous 

I agree with your thoughts and have faced the same problem. We use the EditForm.Valid method to check if the form is valid before submitting. We then use the !Parent.Valid on the asterisk in the cards to show which fields still have to be completed before allowing the submit. 

 

Please see below video that discusses this in more detail.

https://youtu.be/7O8HCz37Q0A

 

Dawid van Heerden
Follow on Twitter: @davestechtips
Subscribe to YouTube: https://www.youtube.com/davestechtips?sub_confirmation=1
**If you found this reply helpful, please mark this as the answer to close the topic and make it easier to find for other people with similar questions. AND we get points for it 😉

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 (4,639)