1

I need to let the user choose a day from a datepicker in a date field, but disabling a list of specific days from the calendar picker, so the user can't select a not available day.

(Just for explain my use case. I am using Date field and Form api. My Disabled days are in a field in several nodes, and I can get the list of disabled days easily from a View listing this date field. If it is needed it can be exported too as json, xml, plain text or any other format, to serve as entry in the calendar picker.)

(After the user choose an available Day, I will have to do the same to let him select an available Time from a time picker. This will be an appointment for a Photography Session.)

  • Just to be curious and probably helping others to answer - how many days do you want to exclude? Excluding a lot of days would introduce some ajax requests to the backend to at least cycle between months. What use case are you trying to handle? In all cases you can validate the submitted day on form submit and display an error message. – Andre Baumeier Feb 10 '17 at 22:40
  • I edited my question to detail my use case. – bunset Feb 11 '17 at 3:16
1

Using this answer: https://stackoverflow.com/a/15400806/1475662 and a bit of custom coding to add the js and the list of available (or not available) dates to the page.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.