How do I disable certain dates on date picker?
-
- Posts: 12
- Joined: Wed Nov 13, 2019
Not seeing documentation on how to do that, just for disabling entire fields...
I tried this code:
I tried this code:
Didn't workfunction setToDateRange() {
fd.field('Effective_x0020_Date').control('kendoDateTimePicker')
.done(function(picker) {
picker.setOptions({
min: 2,
max: 30
});
});
Hello thebrightlord,
You can disable specific dates in the month with the following code. Replace 'Date' with the internal name of your field. If you use Date Only fields, replace 'kendoDateTimePicker' with 'kendoDatePicker'.
You can disable specific dates in the month with the following code. Replace 'Date' with the internal name of your field. If you use Date Only fields, replace 'kendoDateTimePicker' with 'kendoDatePicker'.
Code: Select all
fd.field('Date').control('kendoDateTimePicker').done(function(picker) {
picker.setOptions({
value: new Date(),
disableDates: function (date) {
var disabled = [2,30];
if (date && disabled.indexOf(date.getDate()) > -1 ) {
return true;
} else {
return false;
}
}
});
});
-
- Posts: 12
- Joined: Wed Nov 13, 2019
Thank you Margarita.
Your code sparked an idea and I modified it to this:
I needed to only allow 2 days past today as minimum and 30 days past today as maximum.
Your code sparked an idea and I modified it to this:
Code: Select all
var today = new Date();
var minDate = today.setDate(today.getDate()+2);
var maxDate = today.setDate(today.getDate()+30);
fd.field('Effective_x0020_Date').control('kendoDatePicker').done(function(picker) {
picker.setOptions({
min: new Date(minDate),
max: new Date(maxDate)
})
});
I have similar issue, but I can't get the code to work...
I have Date Picker field, but in Related Items in Quick Edit Mode and need to allow entries for only the past 3 days.
I tried both upper codes (I even replaced fd.field with fd.relatedItems), but no succes. Does the code differ, if the field is in Related Items?
Regards,
Tanja
I have Date Picker field, but in Related Items in Quick Edit Mode and need to allow entries for only the past 3 days.
I tried both upper codes (I even replaced fd.field with fd.relatedItems), but no succes. Does the code differ, if the field is in Related Items?
Regards,
Tanja
Hello Tanja1980,
I'm sorry for the delay in reply!
This approach is not applicable to the Date column in related items. And It is not possible to interact with Related items in quick edit mode using JS.
But you can try out the SharePoint column validation. Please find more information in this article:
https://support.office.com/en-us/articl ... 7ebf6988b3
And in this post:
https://sharepoint.stackexchange.com/qu ... odays-date
I'm sorry for the delay in reply!
This approach is not applicable to the Date column in related items. And It is not possible to interact with Related items in quick edit mode using JS.
But you can try out the SharePoint column validation. Please find more information in this article:
https://support.office.com/en-us/articl ... 7ebf6988b3
And in this post:
https://sharepoint.stackexchange.com/qu ... odays-date
-
- Information
-
Who is online
Users browsing this forum: No registered users and 11 guests