dominoGuru.com
Your Development & Design Resource
Dynarch Calendar - Date Blockers
01/25/2007 03:56 PM by Chris Toohey
A client of mine has a "Time & Attendance" database that I was updating the code to be a little more web-savvy. Using the open source DHTML calendar from Dynarch, I was able to give a pretty snazzy looking calendar tool. But the functionality of the time sheets called for the user to select a Sunday as the start date for the timesheet, and if they did not it would alert them to make another selection. Instead of doing this, I decided to only allow the user to select a Sunday from the DHTML calendar itself and, along with the assistance of the DominoGuru himself, came up with the JavaScript function to add to the calendar to achieve this.
This particular calendar has the functionality built in to run a JavaScript
function to basically "turn off" dates you do not want to have available. So I
used the code below to turn off all dates except Sundays:
function dateStatus(date) {
if (date.getDay() != 0) {
return true; // true says "disable"
} else {
return false; // leave other dates enabled
}
}
...then in the Calendar.setup code I added this:
Calendar.setup(
and BINGO!
{
inputField:"calendar_date",
ifFormat:"%m/%e/%Y",
button:"calendar_trigger",
align:"BR",
singleClick:"false",
dateStatusFunc:dateStatus
}
)
Michael Smelser
Lotus Notes/Domino Application Developer
Lotus911
770.517.0092 (phone) | 404.663.1058 (cell) | 678.594.6756 (fax)
http://www.Lotus911.com