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 / Disabling a button whe...
Power Apps
Answered

Disabling a button when current date doesn't match the given date

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

So i have a QR code that puts out a email and then a date, then the email is used to find more data on the user. this all works.
But the date is also given as more of a security reason, when it doesn't match the current date the user shouldn't be able to press the next button to continue the process. 

the data this variable puts out is 24-07-2020, i checked this by putting it in a text field and looking at the output. 

WesselO_0-1595602154466.png

 

"Datum: " & _gastdatum

 

 
i tried adding the code below to the displaymode tag of the button itself, 

If(IsToday(DateTimeValue(_gastdatum, "DD-MM-YYYY")),
 DisplayMode.Edit,
 Disabled
)

 

 

But unfortunately, the button stays the same even thought he dates are matching.
If u need any more info please let me know. 
Any insight or help would be appreciated, thank you so much. 


Categories:
  • KrishnaV Profile Picture
    5,023 on at

    Hi @Anonymous ,

     

    try this:

    If(Text(Today(),DateTimeFormat.ShortDate) = Text(gastdatum,DateTimeFormat.ShortDate),
     DisplayMode.Edit,
     Disabled
    )

     
    I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

    Regards,
    Krishna
    If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

  • eka24 Profile Picture
    20,925 on at

    Try

    If(IsToday(DateValue(_gastdatum, "DD-MM-YYYY")), DisplayMode.Edit, Disabled )

    If(Text(Today'"DD-MM-YYYY")=Text(_gastdatum, "DD-MM-YYYY"), DisplayMode.Edit, Disabled )

     

    If you have issues, explain how you got the variable _gastdatum further 

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hey Krishna, 
    i tried this and unfortunately it doesn't work for me. 
    after scanning the qr code with a correct date the button is still greyed out for me,

    a screenshot below.

     

    IMG_20200724_165834

  • KrishnaV Profile Picture
    5,023 on at

    Hi @Anonymous ,

     

    try this:

    if(Text(Today(),"dd-mm-yyyy") = Text(columnName,"dd-mm-yyyy"),Edit,Disabled)

    Note: "dd-mm-yyyy" is case sensitive 

     

    I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

    Regards,
    Krishna
    If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hey eka24,

     

    i tried both your solutions and unfortunately it didnt work for me.

    the way i get this variable is through scanning a qr code, which is this link
    https://chart.googleapis.com/chart?cht=qr&chl=example@email.nl,24-07-2020&choe=UTF-8&chs=400x400

    i then proceed to split the email and the date from eachother like so,

    Set(_gastemail, First(Split(btn_scanner_qr.Value, ",")).Result),
    Set(_gastdatum, Last(Split(btn_scanner_qr.Value, ",")).Result)

    this gets done on qr scan, after which the data gets shown on screen and u get the option to continue, this is where the button part comes in and the button should be disabled when the date isn't correct.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    hey KrishnaV, thank you for the continueous help.

    i get a error code here, not sure what it is. 

    WesselO_0-1595603310143.png

     

  • KrishnaV Profile Picture
    5,023 on at

    Hi @Anonymous ,

     

    Try this:
    Set this to Display mode property:

    if(Text(Today(),"dd-mm-yyyy") = Text(columnName,"dd-mm-yyyy"),DisplayMode.Edit,DisplayMode.Disabled)


    I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

    Regards,
    Krishna
    If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hey krishnaV,

    unfortunately i get the same error.

  • Verified answer
    KrishnaV Profile Picture
    5,023 on at

    Hi @Anonymous ,

     

    Try this for the final time on DisplayMode property:

    If(Text(Today(),"dd-mm-yyyy") = Text(_gastdatum, "dd-mm-yyyy"),DisplayMode.Edit,DisplayMode.Disabled)

     
    I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

    Regards,
    Krishna
    If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

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 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard