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.
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.
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).
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.
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?
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"
)
)
WarrenBelz
89
Most Valuable Professional
MS.Ragavendar
60
stampcoin
48