web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / OnChange of Date Picke...
Power Apps
Unanswered

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard