This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
Disable specific dates in calendar
Started 14 years ago by parker | 5 posts |
-
Hello everyone!
I have been seaching for a way to disable specific dates in the calendar picker, because the dates I want to be available are all the Thursday of every month. I have see how to disable previous dates, but I don't know what I should change in the code to make that work.
Do you guys have a way to resolve this issue?
THANK YOU very much for your time!
Parker
Posted 14 years ago # -
Hello Parker,
Do you want to allow a user select a date on Thursday only ? If so, you can edit "includes/view-functions.php" file and search for these code :
<script type="text/javascript"> Calendar.setup({ inputField : "element_{$element->id}_3", baseField : "element_{$element->id}", displayArea : "calendar_{$element->id}", button : "cal_img_{$element->id}", ifFormat : "%B %e, %Y", onSelect : selectDate }); </script>
It's around line 379 - 388. Then try to change those code with this
<script type="text/javascript"> Calendar.setup({ disableFunc : function(date) { if (date.getDay() != 4) { return true; } else { return false; } }, inputField : "element_{$element->id}_3", baseField : "element_{$element->id}", displayArea : "calendar_{$element->id}", button : "cal_img_{$element->id}", ifFormat : "%B %e, %Y", onSelect : selectDate }); </script>
MachForm Support
Posted 14 years ago # -
Hey!!!
I just want to take a sec to thank all your team for the support, it is the second time I answer a question and I see that most of people's question are answered within a day with the perfect solution, which is not common!!
Ok! So now lol:
The modification worked like a charm, however when I come to click on the calendar, I can't select any date, including the dates of Thursday. (I uploaded a test file) http://charnobylvoice.com/test/form.htmlIm using a pform, so I changed the form.html
This is the code I've changed to, because the one you posted didn't seem to work:
<script type="text/javascript">
Calendar.setup({
disableFunc : function(date) {
if (date.getDay() != 3) {
return true;
} else {
return false;
}
},
inputField : "element_2_3",
baseField : "element_2",
displayArea : "calendar_2",
button : "cal_img_2",
ifFormat : "%B %e, %Y",
onSelect : selectDate
});
</script>All right Thank you again!
Posted 14 years ago # -
Hmmm, any luck? I've tried different things but I still can't make it work out. :(
Posted 14 years ago # -
Hey guys, Im sorry to ask this again but did anybody have some pointers for me :s
Thanks in advance!!!
Posted 14 years ago #
Reply
You must log in to post.