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 / How do you make a requ...
Power Apps
Answered

How do you make a required column issue an error before submit form or trap afterwards

(0) ShareShare
ReportReport
Posted on by 2

Example of what does not work.  A column is set to required (actually not the column but the encompassing datacard).  The code below is executed via a button without filling the required column.

 

SubmitForm(form_Edit);
UpdateContext(
    {
        EditRecord: First(
            Filter(
                '[dbo].[TestSource]',
                TestIndex = _CurTestIndex
            )
        )
    }
);
If(
    IsEmpty(
        Errors (
            '[dbo].[TestSource]',
            EditRecord
        )
    ),
    Back()  
)

 

The program actually executed the "Back()" function ignoring there is an error. I have tried it with and and without an EditRecord.  What does happen on the very first occurence (non on subsequent), the error shows on the page returned to (from back()) (see attached ErrorOnPriorPage.jpg).  If you show the submited form again, then you will see the column is highlighted in error that it is required (see ErrorOnFormPage.jpg).

 

The behavior I want is to stop the page from submitting when there is a required column.  Ideally, testing for the error on the page before submitting?

 

ErrorOnFormPageJPG.JPG
ErrorOnPriorPage.JPG
Categories:
  • PaulD1 Profile Picture
    2,914 on at

    I take the approach of setting the Display property of the Submit button to Disabled unless all the required fields are completed - check using IsEmpty(MyTextField.Text)

    That way you don't need to worry about an error where a user submits an incomplete record.

  • Rick4him Profile Picture
    2 on at

    Yes, I have tried that but what is the purpose to have a required data card that does not give you the message it was not filled until after you leave the page as you cannot tell it was required on the page, I wonder if the developer actually tested the functionality using a form.  I am going toward changing submit forms to patch, a lot of extra work but does seem to give you finer control. 

  • Verified answer
    PaulD1 Profile Picture
    2,914 on at

    Move your Back() command to the OnSuccess property of the form. That way, if the Submit fails, you are not moved to a different screen.

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 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard