Block Saturdays in date field of concrete5 form block

Permalink 2 users found helpful
Hello Guys,

Can anyone help me with this topic?

I want to block all saturdays (day not selectable) on the date field of the concrete 5 form block.

Thanks ;)

lpsnoops
 
goutnet replied on at Permalink Reply
I think you gonna need a custom block for this.
shahroq replied on at Permalink Best Answer Reply
shahroq
hi
this is a hacky way to do such a thing, it's not perfect because user still can edit textfield (without using datepicker):
1- open file: /concrete/core/helpers/form/date_time.php
2- at line 204, find where datepicker defined:
$html .= '<script type="text/javascript">$(function() { $("#' . $id . '").datepicker({ dateFormat: \'' . DATE_APP_DATE_PICKER . '\', changeYear: true, showAnim: \'fadeIn\' }); });</script>';

and replace it with:
$html .= '<script type="text/javascript">$(function() { $("#' . $id . '").datepicker({ dateFormat: \'' . DATE_APP_DATE_PICKER . '\', changeYear: true, showAnim: \'fadeIn\', beforeShowDay: function(day) { var day = day.getDay(); if (day == 6) { return [false, "somecssclass"] } else { return [true, "someothercssclass"] } } }); });</script>';


remember saturday is considered sixth day of the week, if u want to disable other days, change that number.
lpsnoops replied on at Permalink Reply
lpsnoops
Shahroq, great, this works and its true. Thanks :)
lpsnoops replied on at Permalink Reply
lpsnoops
Hello, i want to disable sundays,how to do it? More.. its possible to disable specific days like the Holiddays? if ther is possible you can show how to make it? Thanks,
Luis