Disable 2 Chosen Days In Datepicker

User 2642607 Photo


Registered User
25 posts

I just want to share a solution I had answered on stackoverflow.
My issue was I wanted to disable Friday and Saturday so they cannot be selected in the datepicker calendar.
First open jquery.ui.datepicker in an editor like notepad++, then;
At line 92 you must replace this code

beforeShowDay: null, // Function that takes a date and returns an array with
// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
// [2] = cell title (optional), e.g. $.datepicker.noWeekends


for this code (for disable friday and saturday)

beforeShowDay: function(date) {
var show = true;
if(date.getDay()==5||date.getDay()==6) show=false
return [show];
},


The reason I'm sharing is I spent two days trying various different snippets of code in both the form html file and the jquery.ui.datepicker file and the above is the only thing I found that actually worked.

I kinda figured it might save someone a bit of time if ever they need to do this
User 2642607 Photo


Registered User
25 posts

fyi....
sunday = 0
monday = 1
tuesday = 2
wednesday = 3
thursday = 4
friday = 5
saturday = 6

So the above code can be used to permanently disable any day you choose
User 187934 Photo


Senior Advisor
18,025 posts

Hi Michael,
I have a working example of this where you don't need to alter anything after export.
http://progrower.coffeecup.com/forms/disable-fri-sat/
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com
http://ericrohloff.com/property/
User 2642607 Photo


Registered User
25 posts

Hey Eric, I wish I could have found that 2 days ago :lol:

But you are right to point out that it should be edited after export, I didn't mention that.

Anyway, I think it's great that there are two different working methods stored here that people can choose to use if required.
User 122279 Photo


Senior Advisor
11,244 posts

Eric, I have a question regarding your datepicker form above. I'm not able to make it work. So since you are saying in the instructions: 'Paste the code below into a HTML element.', do you mean a html element within the form, or one on the page where the form is to appear? I've tried the former and uploaded it to the S-drive, but it doesn't work, and it freezes up my Firefox. I may have done something wrong, but at least the ID of my date field is the same as in your example.
Ha en riktig god dag!
Inger, Norway
My new honey site, built with RFF: http://www.horgenhonning.net/
Component sharing for RFF, RBB, RSD and SD: http://www.horgenhonning.net/sharing/


User 187934 Photo


Senior Advisor
18,025 posts

I added the code directly to a html element within form builder.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com
http://ericrohloff.com/property/
User 122279 Photo


Senior Advisor
11,244 posts

I still can't get it to work. I tried uploading to a server, but it was no go. I get the options whether to continue or stop the script, and I can't do anything before I stop it, not even close the page.
Ha en riktig god dag!
Inger, Norway
My new honey site, built with RFF: http://www.horgenhonning.net/
Component sharing for RFF, RBB, RSD and SD: http://www.horgenhonning.net/sharing/


User 187934 Photo


Senior Advisor
18,025 posts

Can you share a link?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com
http://ericrohloff.com/property/
User 122279 Photo


Senior Advisor
11,244 posts

I deleted what I did, but I'll recreate it tomorrow. If it still doesn't work, I'll give a link.
Ha en riktig god dag!
Inger, Norway
My new honey site, built with RFF: http://www.horgenhonning.net/
Component sharing for RFF, RBB, RSD and SD: http://www.horgenhonning.net/sharing/


User 122279 Photo


Senior Advisor
11,244 posts

I'm attaching the zipped .fb file. I haven't uploaded it this time. If necessary, I'll do it later today.
It's not that I need this form right now, I just wanted to try it and have it for later.
Attachments:
Ha en riktig god dag!
Inger, Norway
My new honey site, built with RFF: http://www.horgenhonning.net/
Component sharing for RFF, RBB, RSD and SD: http://www.horgenhonning.net/sharing/



Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.