Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In Date Field - cannot add days that are not allowed (like Sundays)
We use form for appointments and would like to restrict users to not request for appointments on weekends using the date field.
I've searched around, but couldn't find any suitable answer for drupal 8 webforms.
If there's a workaround, please do let me know.
Thanks
Comment | File | Size | Author |
---|---|---|---|
#8 | disable-days-2901873-8.patch | 6.73 KB | Benaan |
#4 | Screenshot 2017-08-15 23.52.07.png | 30.98 KB | omdb |
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedYou can create a Date element with a jQuery UI datepicker and add some JS to customize the calendar.
@https://stackoverflow.com/questions/2968414/disable-specific-days-of-the... @https://codepen.io/anon/pen/XmQrPY
Comment #3
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #4
omdb CreditAttribution: omdb commentedI created a Date element, selected "Use date picker"
I then added this on page load:
But nothing happens.
If I run the code in console, the window updates and disables Sundays. But when I click out and click again, it is back to normal. Is there something I am missing here?
Comment #5
omdb CreditAttribution: omdb commentedChanging status for visibility. Sorry if this breaks any rules.
Comment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedWe can't support custom code in the Webform issue queue. If you need coding help, you should post your question to https://drupal.stackexchange.com/questions/tagged/webform
Comment #7
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #8
Benaan CreditAttribution: Benaan commentedI've created a patch that makes this configurable.
Comment #9
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #11
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI am not ready to support this feature in the core webform module.
I think there needs to be a dedicated datepicker element that implements all the options available for the jQuery UI Datepicker. This element should be handled in a dedicated contrib module.
@see #2778335: Port to drupal 8
Comment #12
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #13
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #14
webengr CreditAttribution: webengr commentedWas this ever solved by a module or putting custom javascript in webform settings?