Disable 2 Chosen Days In Datepicker -...

User 2642607 Photo


Registered User
33 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
33 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
20,181 posts
Online Now

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.

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 personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2642607 Photo


Registered User
33 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
14,447 posts
Online Now

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 work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 187934 Photo


Senior Advisor
20,181 posts
Online Now

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.

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 personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 122279 Photo


Senior Advisor
14,447 posts
Online Now

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 work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 187934 Photo


Senior Advisor
20,181 posts
Online Now

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.

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 personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 122279 Photo


Senior Advisor
14,447 posts
Online Now

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 work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 122279 Photo


Senior Advisor
14,447 posts
Online Now

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 work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com



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.