Set MinDate +2 - Post ID 219097

User 362156 Photo


Registered User
45 posts

I'm working on a new form through which our clients can directly book transfers to and form the airport. Clients can book a transfer from today + 2 (D+2). I have worked with datepicker before and know you can block earlier dates by setting minDate at '+2' but I can't get this to work with the files generated by WFB. I have played with minDate in jquery.ui.datepicker.js but without succes. Changes in this file seem to be overruled by validation_data.js? Anybody ever tried a possible workaround here?
User 187934 Photo


Senior Advisor
20,181 posts

I did this by replacing the date picker with an outside source instead of the built in one. I know I put an example up in this forum.:)
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 362156 Photo


Registered User
45 posts

Hi Eric, I have searched every corner of the forum for your example but couldn't find it. Any chance of you having saved your notes ;) ?
User 187934 Photo


Senior Advisor
20,181 posts

Take a look at this.
http://ericrohloff.com/coffeecup/ccforu … ickerdays/
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 362156 Photo


Registered User
45 posts

Ah, now I understand what you meant with "an example on this forum":rolleyes:

I can get your solution working in a standalone form, change the minDate to +2 so everything works as I want it to work. However, when I add this to my form.html, change the id from item1_date to item138_date_1 (datepicker id in my form) the script doesn't work. It seems to have something to do with the addition _1 to the datefield id, but I can't figure it out. Before I start throwing my keyboard out of the window I'm going to stop for today and continue tomorrow.
User 187934 Photo


Senior Advisor
20,181 posts

Yup you can't alter the id's in the form unless your going to include your own outside libraries to bind to them.
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 2077947 Photo


Registered User
40 posts

Johan wrote:
I'm working on a new form through which our clients can directly book transfers to and form the airport. Clients can book a transfer from today + 2 (D+2). I have worked with datepicker before and know you can block earlier dates by setting minDate at '+2' but I can't get this to work with the files generated by WFB. I have played with minDate in jquery.ui.datepicker.js but without succes. Changes in this file seem to be overruled by validation_data.js? Anybody ever tried a possible workaround here?


I had this same problem and found a solution :)

Let me know if you're still interested!

As shown on our Order Form where the Skip Delivery & Collection Dates are set to min = 1 and max=60

http://www.skipy.co.uk/skip_online_order_form.html
R K BAILEY
User 362156 Photo


Registered User
45 posts

I had to abandon this project for a few weeks, but I plan to pick it up over the coming days.

Yes, I'm really interested in your solution, it seems to work exactly as what I'm looking for.
User 2151990 Photo


Registered User
3 posts

Hi Eric, is there any way to disable days directly from the "jquery.ui.datepicker.js" and avoid placing the script from your example above the </head> tag? There is a conflict with other js files when I place your script above the </head> tag and I can't do it that way.
I want to disable Monday and Tuesday if you can help me with that I would very much appreciate it.

User 187934 Photo


Senior Advisor
20,181 posts

Sure try this. Paste it into an html element. Adjust the item1_date_1 to the actual ID of your datepicker.
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css" /><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script><script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> <script>var jQ = $.noConflict();
jQ(document).ready(function() {
// adjust this to the actual ID of your datepicker
jQ("#item1_date_1").attr("id","item1_date");
});
var jK = jQ.noConflict();
jK( window ).load(function() {
// 1 = monday, 2 = tuesday, 3 = wednesday, 4 = thursday, 5=friday, 6 = saturday, 7=sunday //
var daysToDisable = [1, 2];
jK("#item1_date").datepicker({ beforeShowDay: disableSpecificWeekDays, minDate: 0 });
function disableSpecificWeekDays(date)
{ var day = date.getDay(); for (i = 0; i < daysToDisable.length; i++)
{ if (jK.inArray(day, daysToDisable) != -1)
{ return [false]; } } return [true]; }
});</script>
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

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.