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 / Disable or grey the fe...
Power Apps
Unanswered

Disable or grey the felt out

(0) ShareShare
ReportReport
Posted on by 53

I have a time registration app where it writes to a share point list - what I would like is that those who use it may not register time further back, e.g. the date field must be visible only for the current month + 5 days in the next month. Ex. August + 5 in September.

Categories:
I have the same question (0)
  • Chris-D Profile Picture
    1,246 on at

    Hi @BR1984 , you can't do this with a normal date picker control, but you can check the selected date and use this elsewhere, like to disable your submit button. 

     

    You can use this code on a text label, customise it as needed 🙂

     

    With({
     Date: DatePicker1.SelectedDate,
     StartDate: DateAdd( Today(), -14), // 2 weeks ago
     EndDate: DateAdd( Today(), 14) // 2 weeks from now
    },
     If( Date >= StartDate && Date <= EndDate,
     "Date is ok",
     "Date out of range"
     )
    )

     

    ChrisD_0-1695745574573.png

    ChrisD_1-1695745603308.png

     

  • BR1984 Profile Picture
    53 on at

    Thank you, i have thought about it and it will be great if we can lock a month so the employes cant enter that month any more - but i cant figure it out how to do, we have a sharepoint list where all data come to, so i dont have any parameter to lock the month from sharepoint list.

    Any idea?

     

  • Chris-D Profile Picture
    1,246 on at

    Yes, I've told you how to do it. Put the code above in the OnChange of the date picker. Set a variable if the date is valid or not and use that variable to disable your submit button.

  • BR1984 Profile Picture
    53 on at

    Hi Chris-D, i made a sharepoint list with datetime column and Lock column true/false, we want to lock a month who meens that if date is 01-10-2023 and locked is true it should no be able to selcet the datepicker on App as the month is locked, i have try it with different code but it does not work.

    The datepicker has direct connection to SharePoint when the users register the time on my other sharepointlist.

     

    the code i have been tryin is this:

    If( IsBlank( LookUp( MÃ¥neder, DateValue(Dato, "[$-da-DK]dd-MM-yyyy") = DateValue(Text(DatePicker1.SelectedDate, "dd-MM-yyyy"), "dd-MM-yyyy") && Lock = true ) ), // Handle when the date is in a locked month Notify("This date is locked.", NotificationType.Error).

     

     

     

  • Akah Mandela Profile Picture
    445 on at

    you can use the DisplayMode property of the date picker control. Add a formula to the DisplayMode property of the date picker control that disables it after the user has entered a date for that specific month. Here is an example formula:
    DisplayMode : If (Month(PickerDate.SelectedDate) = 10, Disabled, Edit)

    In this example, the PickerDate is the name of the date picker control. The formula checks if the month of the selected date is October (10th month) and disables the control if it is. Otherwise, it sets the DisplayMode to Edit, which allows the user to enter a date.

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard