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 / Only required validati...
Power Apps
Suggested Answer

Only required validation working. Not other

(0) ShareShare
ReportReport
Posted on by 112
I have a Start Date and End Date datacard in Powerapps newform. I have set the datacard required field to true. The validation works fine without any issues. When i try to submit the form, it throws error saying field is required. 
 
I added one more validation on the date field on the DataCard error message. The validation works fine and shows error message, however i can bypass the error message and submit. May i know why?
 
DataCard Error Text property
If(
    !IsBlank(Parent.Error),
    "End Date is required",
    DateDiff(
        DataCardValue54.SelectedDate,
        DataCardValue55.SelectedDate,
        TimeUnit.Days
    ) > 30,
    "The End Date field cannot be less than 30 days from StartDate",
    ""
)
 
I have the same question (0)
  • Suggested answer
    RaghavMishra Profile Picture
    18 on at

    Hi,

    What you're seeing is by design. In Power Apps Edit forms, only two things actually block SubmitForm:

    1. A Required field is empty (this is why your “End Date is required” works).
    2. The form's Valid property is false — which is the aggregate of every DataCard's Valid property.

    The DataCard's ErrorMessage / Error text property is display-only — it just shows red text under the card. It does not affect Valid, so SubmitForm happily submits anyway. That's why your 30-day rule is “bypassable”.

    Fix — make the DataCard's Valid property reflect your rule

    On the End Date DataCard, set the Valid property to something like:

    !IsBlank(DataCardValue55.SelectedDate) &&
    DateDiff(DataCardValue54.SelectedDate, DataCardValue55.SelectedDate, TimeUnit.Days) <= 30

    Now the card is only Valid when End Date is filled and within 30 days of Start Date. Because the form's overall Valid is the AND of all DataCards, SubmitForm will refuse to run until the rule is met.

    Keep your friendly error message

    Leave your existing ErrorMessage formula (or simplify it) so the user sees why it's blocked:

    If(
        IsBlank(DataCardValue55.SelectedDate),
        "End Date is required",
        DateDiff(DataCardValue54.SelectedDate, DataCardValue55.SelectedDate, TimeUnit.Days) > 30,
        "The End Date cannot be more than 30 days from Start Date",
        ""
    )

    Belt-and-suspenders on the Submit button

    Per Microsoft Learn, the recommended pattern is to guard the submit button itself:

    • DisplayModeIf(SubmitFormName.Valid, DisplayMode.Edit, DisplayMode.Disabled)
    • OnSelectIf(SubmitFormName.Valid, SubmitForm(SubmitFormName))

    This prevents the user from even clicking submit while any DataCard is invalid.

    📚 Reference: Edit form and Display form controls in Power Apps — SubmitForm & Valid (Microsoft Learn)

    Found this helpful? Please mark ✅ “Does this answer your question?” so others searching for the same issue can find it quickly. A 👍 on “Was this reply helpful?” or a ♥ Like is also much appreciated!

    Raghav Mishra — LinkedIn | PowerAI Labs

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 834

#2
Valantis Profile Picture

Valantis 533

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard