“im using an inline JQuery UI datepicker with an onSelect callback function. This function collects selected dates in an array for multiple dates. My problem is that datepicker calls this function on startup with selecting today, and adding it to my array. How can I disable this behaviour? I dont need to know which day is today, don’t want to add it to my array automatically…
Thanks in advance for nay help!
Edit: Here’s my (pretty simple) onSelect callback as requested:
var blocked_days = new Array([..]);
function updateSelected(dateText)
{
var toAdd = true;
for (var i in blocked_days)
{
if (dateText == blocked_days[i])
{
blocked_days[i] = null;
toAdd = false;
}
}
if (toAdd === true)
blocked_days[blocked_days.length] = dateText;
$("#special_offer_blocked_form_blockeddays").val(blocked_days.join());
}
Have you got your code for the onSelect callback function?
One way around it would be to update the callback function with a check that checks that the date is not today. If it isn’t then add the date.
If you can provide an example of your onSelect code I will be more than happy to take a look and add this?
Update:
What you could do then is set a simple counter each time the function is called, always ignoring the first call.
Try that and see if that works?