For date fields, can you disable dates from being picked?

e_wilber
Tera Guru

Is it possible to only allow certain days of the week to be selected when using a date field? In particular, we'd like the users to only be able to select Fridays that are at least one full week in advance.

I know I can create a client script to do some validation on the day of the week and if we have enough notice, however, is there a way to simply prevent the user from selecting any of the other days of the week?

2 REPLIES 2

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Eric,



I don't think it's possible with the date field that ServiceNow uses. As you said you could run an onchange client script on it and do some validation after they select the date, but it's not as good a user experience.



Something that I have seen is to create a custom date field in a ui macro and do some of that validation with a jquery plugin, then use a formatter to show the macro on a form. You can populate a hidden date field after they select the date in the macro.


Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Perhaps this could help you, but it has some flaws...




How to remove Sundays and Saturdays from the calendar pickers?