close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Change Datepicker

Thread began 11/01/2011 7:05 pm by elgueromero13396227 | Last modified 11/02/2011 6:50 pm by CraigR | 831 views | 3 replies |

elgueromero13396227

Change Datepicker

smoke_detector_testing_application.php

Does anyone have any advice on how to change the datepicker so that the user can only select Tuesdays? Thanks

Sign in to reply to this post

CraigRBeta Tester

The function you need is beforeShowDay

here is an example which should work for you.

$('#datepicker_1').datepicker({
beforeShowDay: nonWorkingDates,
dateFormat: 'dd/mm/yy',
showAnim: 'show',
onClose: closeDatePicker_datepicker_1
});

function nonWorkingDates(date){
var day = date.getDay(), Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6;
var closedDays = [[Sunday],[Monday],[Wednesday],[Thursday],[Friday],[Saturday]];
for (var i = 0; i < closedDays.length; i++) {
if (day == closedDays[i][0]) {
return [false];
}
}

return [true];
}

code you need is in red.

For other days to exclude, such as national holidays, take a look at the original thread..

can-the-jquery-ui-datepicker-be-made-to-disable-saturdays-and-sundays-and-holid



Sign in to reply to this post

elgueromero13396227

WOW nice one. Thanks. Can I buy you a beer lol Will this site let me know how to omit the previous Tuesday that has gone buy already? Thanks again as it worked great!

Sign in to reply to this post

CraigRBeta Tester

actually, yes, (on both q's).

if you google the function name, you will probably find a code snippet to do that for you too

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...