Op de webpagina
webshop.php?formshop_redir=true staat de datepicker, maar hoe deze er komt kan ik niet zien (wordt server-side en dus in dit geval in php geregeld?).
Als je de broncode bekijkt zie je dat er een DatePicker gemaakt wordt op de pagina:
[js]datePickerController.addEvent(window, "load", function() {
var opts = {
// The ID of the associated form element
id:"dp-js1",
// The date format to use
format:"d-sl-m-sl-Y",
// Days to highlight (starts on Monday)
highlightDays:[0,0,0,0,0,1,1],
// Days of the week to disable (starts on Monday)
disabledDays:[0,0,0,0,0,0,0],
// Dates to disable (YYYYMMDD format, "*" wildcards excepted)
disabledDates:{
"20090601":"20090612", // Range of dates
"20090622":"1", // Single date
"****1225":"1" // Wildcard example
},
// Date to always enable
enabledDates:{},
// Don't fade in the datepicker
// NOTE: Only relevant if "staticPos" is set to false
noFadeEffect:false,
// Is it inline or popup
staticPos:false,
// Do we hide the associated form element on create
hideInput:false,
// Do we hide the today button
noToday:true,
// Do we show weeks along the left hand side
showWeeks:true,
// Is it drag disabled
// NOTE: Only relevant if "staticPos" is set to false
dragDisabled:true,
// Positioned the datepicker within a wrapper div of your choice (requires the ID of the wrapper element)
// NOTE: Only relevant if "staticPos" is set to true
positioned:"",
// Do we fill the entire grid with dates
fillGrid:true,
// Do we constrain dates not within the current month so that they cannot be selected
constrainSelection:true,
// Callback Object
callbacks:{"create":[createSpanElement], "dateselect":[showEnglishDate]},
// Do we create the button within a wrapper element of your choice (requires the ID of the wrapper element)
// NOTE: Only relevant if staticPos is set to false
buttonWrapper:"",
// Do we start the cursor on a specific date (YYYYMMDD format string)
cursorDate:""
};
datePickerController.createDatePicker(opts);
});[/js]
Als je dit kan aanpassen (misschien staat dit ergens in de server-side code, ik kan dit niet zien) zit je goed. Je zou het dan naar iets zoals dit moeten aanpassen:
[js]
datePickerController.addEvent(window, "load", function() {
var curDate = new Date();
curDate.setHours(12);
if(curDate.getHours() > 13){
curDate.setDate(curDate.getDate()+1);
}
var dateStringMonth = (curDate.getMonth() + 1).toString();
var dateStringDate = curDate.getDate().toString();
if(parseInt(dateStringMonth) < 10 && dateStringMonth.indexOf("0") != 0){
dateStringMonth = "0" + dateStringMonth;
}
if(parseInt(dateStringDate) < 10 && dateStringDate.indexOf("0") != 0){
dateStringDate = "0" + dateStringDate;
}
var dateStringResult = curDate.getFullYear() + dateStringMonth + dateStringDate;
var opts = {
rangeLow: dateStringResult,
// The ID of the associated form element
id:"dp-js1",
// The date format to use
format:"d-sl-m-sl-Y",
// Days to highlight (starts on Monday)
highlightDays:[0,0,0,0,0,1,1],
// Days of the week to disable (starts on Monday)
disabledDays:[0,0,0,0,0,0,0],
// Dates to disable (YYYYMMDD format, "*" wildcards excepted)
disabledDates:{
"20090601":"20090612", // Range of dates
"20090622":"1", // Single date
"****1225":"1" // Wildcard example
},
// Date to always enable
enabledDates:{},
// Don't fade in the datepicker
// NOTE: Only relevant if "staticPos" is set to false
noFadeEffect:false,
// Is it inline or popup
staticPos:false,
// Do we hide the associated form element on create
hideInput:false,
// Do we hide the today button
noToday:true,
// Do we show weeks along the left hand side
showWeeks:true,
// Is it drag disabled
// NOTE: Only relevant if "staticPos" is set to false
dragDisabled:true,
// Positioned the datepicker within a wrapper div of your choice (requires the ID of the wrapper element)
// NOTE: Only relevant if "staticPos" is set to true
positioned:"",
// Do we fill the entire grid with dates
fillGrid:true,
// Do we constrain dates not within the current month so that they cannot be selected
constrainSelection:true,
// Callback Object
callbacks:{"create":[createSpanElement], "dateselect":[showEnglishDate]},
// Do we create the button within a wrapper element of your choice (requires the ID of the wrapper element)
// NOTE: Only relevant if staticPos is set to false
buttonWrapper:"",
// Do we start the cursor on a specific date (YYYYMMDD format string)
cursorDate:""
};
datePickerController.createDatePicker(opts);
});
[/js]
De code moet in ieder geval
niet in het
datepicker.js bestand.