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 / OnChange of Date Picke...
Power Apps
Answered

OnChange of Date Picker, only applies to the first change

(0) ShareShare
ReportReport
Posted on by 920 Super User 2024 Season 1

Hi,

 

i have this in my onchange property of a date picker

 

If (
DataCardValue39_1.SelectedDate > Today(), 

UpdateContext({ResetDatePicker: true}),
UpdateContext({ResetDatePicker: false})
)

 

which works nicely! however if I try it a second time affter the initial reset, it doesnt reset the date picker.

 

Anyone know why?

Categories:
I have the same question (0)
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @wonka1234,

     

    Should the reset be limited to the current DatePicker control you could use the following code (variable is not needed):

    If(
     Self.SelectedDate > Today(),
     Reset(Self)
    )

     

    I hope this helps!

  • LaurensM Profile Picture
    12,516 Moderator on at

    @wonka1234,

     

    I am unable to recreate the issue on my end. A possible explanation as to why the DatePicker will not reset is that the variable is still set to true during the second attempt. Should the variable be shared amongst other controls (that may not set it back to false) - this could explain the issue.

     

    Should you prefer to use a variable instead of the Reset approach above, I would recommend placing both the true and false update within the true section of your If statement:

     

    If(
     DataCardValue39_1.SelectedDate > Today(), 
     UpdateContext({ResetDatePicker: true}); UpdateContext({ResetDatePicker: false})
    )

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 305 Most Valuable Professional

#2
11manish Profile Picture

11manish 212

#3
Valantis Profile Picture

Valantis 167

Last 30 days Overall leaderboard