|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
Problem getting mindate to work with Calendar GroupHello Everybody,
I am new too the YUI library and my first try is to make a calendar for selecting multiple dates. The problem I experience is that I can't make the mindate functionality work properly. On page load I don't see a result, but when I click on a previous month I do see the result of the mindate functionality. As you will understand I would like to exclude all days in the past from the calendar group and ofcourse these days should be excluded on first load. Below you can find the full script I use. You can remove the PHP code, this is just for testing purpose.. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- css --> <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/fonts/fonts-min.css"> <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/calendar/assets/skins/sam/c alendar.css"> <!-- js --> <script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/yahoo-dom-event/yahoo-dom- event.js"></script> <script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/calendar/calendar- min.js"></script> </head> <body> <?php if(isset($_POST['btnSubmit'])) { echo '<pre>'; print_r($_POST); } ?> <hr /> <div id="container"> <form name="FormBeschikbaarheid" id="FormBeschikbaarheid" class="yui- skin-sam" method="post"> <div id="cal1Container"></div> <input type="hidden" name="beschikbaar" id="beschikbaar" /> <div style="clear: both"></div> <input type="submit" name="btnSubmit" id="submit" value="verzenden" /> </form> <script type="text/javascript"> function handleSelect(type,args,obj) { var txtBeschikbaar = document.getElementById ("beschikbaar"); var selected = ""; var arrDates = obj.getSelectedDates(); for (var i = 0; i < arrDates.length; ++i) { var month = arrDates[i].getMonth() + 1; var day = arrDates[i].getDate(); var year = arrDates[i].getFullYear(); selected = selected + month + "/" + day + "/" + year + ", "; } txtBeschikbaar.value = selected.substring(0, selected.length - 2); } var cal1 = new YAHOO.widget.CalendarGroup ("call", "cal1Container"); cal1.cfg.setProperty("mindate", "7/2/2008"); cal1.cfg.setProperty("multi_select", true); cal1.cfg.setProperty("pages", 3); cal1.cfg.setProperty("show_week_header", true); cal1.cfg.setProperty("hide_blank_weeks", false); // Date labels for Netherlands cal1.cfg.setProperty("MONTHS_SHORT", ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"]); cal1.cfg.setProperty("WEEKDAYS_SHORT", ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za"]); cal1.cfg.setProperty("LOCALE_MONTHS", "short"); // Add the event handlers cal1.renderEvent.subscribe(handleSelect, cal1, true); cal1.selectEvent.subscribe(handleSelect, cal1, true); cal1.deselectEvent.subscribe(handleSelect, cal1, true); cal1.render(); </script> </div> </body> </html> |
| Free Forum Powered by Nabble | Forum Help |