Skip to main content

Notifications

Community site session details

Community site session details

Session Id : BrQJPGskVYQ7gl+kDH/4xD
Power Apps - Building Power Apps
Unanswered

Disable or grey the felt out

Like (0) ShareShare
ReportReport
Posted on 26 Sep 2023 12:30:58 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.

  • Akah Mandela Profile Picture
    445 on 14 Oct 2023 at 22:56:55
    Re: Disable or grey the felt out

    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.

  • BR1984 Profile Picture
    53 on 14 Oct 2023 at 22:13:10
    Re: Disable or grey the felt out

    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).

     

     

     

  • Chris-D Profile Picture
    1,246 on 28 Sep 2023 at 08:22:43
    Re: Disable or grey the felt out

    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 27 Sep 2023 at 18:57:59
    Re: Disable or grey the felt out

    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 26 Sep 2023 at 16:26:56
    Re: Disable or grey the felt out

    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

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 89 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 60

#3
stampcoin Profile Picture

stampcoin 48

Overall leaderboard
Loading started