Skip to main content

Notifications

Community site session details

Community site session details

Session Id : ZyOZwSVT+OF3pZgu0aVhiD
Power Apps - Building Power Apps
Answered

Show error message when trying to submit a form if required fields are blanked

Like (0) ShareShare
ReportReport
Posted on 20 Apr 2023 07:33:58 by 121

Hi all,

 

I am new to PowerApps and I'm trying to add some data validation into my form entries.

 

There are certain fields in my form which are required for the form to be submitted.

I have managed to get the error message to come up if the required field is blank, but the error is showing constantly. I only want the error to show if the user tries to submit the form with the field empty.

 

Please see below.

The fields that are required - but the error is constantly showing

jolebe09_0-1681975851829.png

This is where I changed the required field.

jolebe09_1-1681975918261.png

I also have a confirmation pop up after clicking the submit button to confirm the user wants to submit the entry, so the error would have to show up after this.

 

The submit button onselect - 

jolebe09_0-1681976218644.png

 

The confirmation popup onselect if yes - 

jolebe09_1-1681976271834.png

 

The confirmation onselect if no - 

jolebe09_2-1681976291853.png

 

 

Thank you in advance.

  • Verified answer
    Ramole Profile Picture
    Super User 2024 Season 1 on 20 Apr 2023 at 08:33:13
    Re: Show error message when trying to submit a form if required fields are blanked

    Hi @jolebe09 
    The form has already that function and will reset the error back to blank on submit if the Required field is filled, if you want to force try adding this OnSelect of the submit button ResetForm(YourFormName) or to check if the required is filled before submit add this on OnSelect of your button

    If( //The required Datacardvalue names 
     !IsBlank(YourDataCardValueName.Text) && !IsBlank(YourDataCardValueName.Text),
     // Add you logic here for example SubmitForm(AccidentForm)
     SubmitForm(AccidentForm);NewForm(AccidentForm),
    
     // This will be shown if the required field is empty
     Notify("Please make sure all fields are filled in correctly ",NotificationType.Error,3000)
    )

     

  • jolebe09 Profile Picture
    121 on 20 Apr 2023 at 08:00:56
    Re: Show error message when trying to submit a form if required fields are blanked

    Hi Cr1t, thanks for getting back to me.

     

    I think I wanted to go more into the individual data cards and say something like 

    If(
    !IsBlank(DataCardValue20.Text)
    "Field is required"
    )

     

    And then click the submit button and if the error comes up it stays on the page, but if there is no error you get the confirmation pop up.

     

    Thanks

     

  • Cr1t Profile Picture
    555 on 20 Apr 2023 at 07:43:24
    Re: Show error message when trying to submit a form if required fields are blanked

    @jolebe09 

    you can add the data validation formula to the "OnSelect" property of the Submit button.

     

    If( IsBlank(DataCardValue4.Text) || IsBlank(DataCardValue5.Text), Notify("Please fill in all required fields."), SubmitForm(EditForm1) )

     

     

    Replace datacardvalue4.text & form name to your datacard names on the form.

     

    Let me know if this works.

     

    Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

     

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started