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 / Validation not working...
Power Apps
Answered

Validation not working properly

(0) ShareShare
ReportReport
Posted on by 543

Hi

 

I have a form with SharePoint as the datasource. When i select a past date (i.e date less than today) from date picker and click on Save, powerapp doesn't allow to save me the record and displays validation error correctly, however the selected date gets reset after clicking on save.

 

May i know how to avoid this ?

 

picor1.PNGPicor2.PNGPicor3.PNG

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @Iantaylor2050 
    My favorite way is to disable the Submit button until the user has input valid information in the form.

     

    Put this code in the DisplayMode property of the Submit button

    If(DataCardValue3.SelectedDate < MyDate, DisplayMode.Disabled, DisplayMode.Edit)


    Then, to alert the user when an invalid date value was entered, put this code in the OnChange property of the DatePicker.

    If(DataCardValue3.SelectedDate < MyDate, Notify("You cannot enter a past date", NotificationType.Error))


    Finally, put this code in the OnSuccess property of the form to show that the record was successfully submitted

    Notify("This record has been saved successfully", NotificationType.Success)



    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Iantaylor2050 ,

    Do you mean that your datepicker will reset automatically if it does not submit the form when clicking the save button?

    I've made a similar test but not met the same problem as your description.

    I suggest you refer this to check where's your problem:

    1)the form's settings:
    DefaultMode: FormMode.New

    2)datepicker's settings:

    InputTextPlaceholder: blank  (set nothing)

    IsEditable: true

    DefaultDate: Parent.Default

    3)the submit button's OnSelect:

    If(DataCardValue5.SelectedDate<Today(),Notify("wrong date",NotificationType.Error),SubmitForm(Form1);Notify("right",NotificationType.Success))

    (this submit button is outside the form)

     

    If I choose date before today, it will return error and not reset the datepicker.

    71.gif

     

    Best regards,

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 525 Most Valuable Professional

#2
Haque Profile Picture

Haque 273

#3
Kalathiya Profile Picture

Kalathiya 232 Super User 2026 Season 1

Last 30 days Overall leaderboard