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 / Disable a form based o...
Power Apps
Answered

Disable a form based on a conditional statement involving DateDiff

(0) ShareShare
ReportReport
Posted on by 99

THE SCENERIO:

 

I am creating a class scheduler.  I have a CLASS START DATE field and a REGISTRATION DEADLINE DATE field.  I need to restrict the user from being able to fill out the fields of the form if the registration date is less than or equal to 10 days from the current date.

 

I had created a DateDiff statement that calculates the number of days between the current date and the REGISTRATION DATE and it is stored in a text input field (which I have hidden).  I was going to use the value in this text input field to create a "less than or equal to" formula.  For some reason, I can't find a way to get an "If registration date is less than or equal to 10 days, then disable the form".  Any help will be appreciated!

Categories:
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @ShadyCheech,

     

    You can use the DateDiff directly in the DisplayMode property of e.g. the Submit Button or the actual DataCard itself:

     

    If(
     DateDiff(Today(), registrationDate, TimeUnit.Days) <= 10,
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

     

    Additionally, you could use DateDiff(Today(), registrationDate, TimeUnit.Days) <= 10 as the visible property of a label that displays an error message.

     

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

    Thanks!

  • ShadyCheech Profile Picture
    99 on at

    RIGHT ON THE MONEY!  Thanks, @LaurensM!

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 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 204 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard