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

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 @rgriffiths,

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.

rgriffiths
Level: Powered On

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 @rgriffiths 

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 Smiley Wink

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 51 members 4,749 guests
Please welcome our newest community members: