web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Required Form Field Ve...
Power Apps
Answered

Required Form Field Verification

(0) ShareShare
ReportReport
Posted on by 79

Hello, 

 

I have a form containing multiple fields which are all set to be required. How do I confirm all fields are filled out when a user clicks the submit button? Also, once the form has successfully been submitted, having it navigate to the next screen would be great.

 

Previously users were clicking the submit button which navigates them to the second screen. It left them unaware the form had required fields if one field happened to be blank.

 

Any direction or assistance is greatly appreciated!  

 

Screenshot 2024-05-17 141825.png

 

 

 

 

Categories:
  • CU18061035-1 Profile Picture
    Microsoft Employee on at

    Hi @Tasturhelden24 

     

    I am going to assume you are creating a Canvas App. Let me know if you are making a SharePoint Power App Form.

     

    For your "Submit" button, you could change the code from:

     

    SubmitForm(EditForm1)

     

     To:

     

    If(
     EditForm1.Valid,
     SubmitForm(EditForm1),
     // Data validation failed
     Notify(
     "Please correct all errors before submitting the form",
     NotificationType.Error
     )
    );
    

     

     

    Here are some other articles related to what you are trying to do by Matthew Devaney:

    https://www.matthewdevaney.com/10-things-you-should-know-about-power-apps-forms/#2.-Easily-Perform-Data-Validation-With-One-Line-Of-Code-(Valid-Property 

     

    https://www.matthewdevaney.com/how-to-validate-a-power-apps-form-before-submission/ 

     

    The EditForm will also have an OnSuccess property that is called after the form is successfully submitted. Set that to Navigate to your next screen similar to the following:

    MarkBandR_0-1715974846111.png

     

     

    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up.

    Thanks

  • Tasturhelden24 Profile Picture
    79 on at

    The following worked great but still encountered a slight problem.

     

    First I added the suggested code to the submit button. 

    If(
     onboarding.Valid,
     SubmitForm(onboarding),
     // Data validation failed
     Notify(
     "Please correct all errors before submitting the form",
     NotificationType.Error
     )
    );

     

    Second, selecting the form and going to OnSuccess, I added the navigation code to the second screen. So filling out all the fields and submitting works great!

     

    So the notification banner works, but how do I get it to highlight the missing field in red? I reviewed Matthew's Devaney write, but seems like a lot of code for something simple? 

     

     

     

  • Verified answer
    CU18061035-1 Profile Picture
    Microsoft Employee on at

    Hi @Tasturhelden24 

     

    Sorry about that. I see exactly what you mean. The Required fields won't be marked. The following should work:

     

    If(
     !EditForm1.Valid,
     // Data validation failed
     Notify(
     "Please correct all errors before submitting the form",
     NotificationType.Error
     )
    );
    SubmitForm(EditForm1);

     

     

    The user will be notified of the error. The button click will still try to Submit the form, but this will cause the Error text boxes to show up and the fields to be highlighted in red.

     

    Since you moved the Navigate function to the OnSuccess of the EditForm, the navigation will not occur unless the form is valid and saved.

     

    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up.

    -Mark

     

  • Tasturhelden24 Profile Picture
    79 on at

    I moved the SubmitForm at the end as suggested. That worked!! 

    If(
     onboarding.Valid,
     // Data validation failed
     Notify(
     "Please correct all errors before submitting the form",
     NotificationType.Error
     )
    );
    SubmitForm(onboarding); I have been learning a lot about Powerapps in the recent month. 

    Learning PowerApps within the past month has been interesting and I have been learning a lot. Thank you for the help! 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard