Problem with flat calendar
2008/09/17 22:20
Viewed 1548 times
Replies: 0/0

I'm having an issue using the flat calendar. I can get it to work as long as the user selects a date, including the current date, but if they do not click on a date, the date gets set to December 31, 1969. Obviously this presents a problem. Also, every time I try to set the inputField to the id of the input on the form, the calendar fails to display. If I either get rid of the input tag on the form, or get rid of the inputField info in the Calendar.setup, the calendar displays.

The only way I can get the calendar to work at all flat is to use this (in which case the calendar displays and works correctly):

the first line of my form:
<input name="Date" type="text" id="date">

my script after the form:

<script type="text/javascript">

function dateChanged(calendar) {
// Beware that this function is called even if the end-user only
// changed the month/year. In order to determine if a date was
// clicked you can use the dateClicked property of the calendar:

document.timesheet.Date.value = calendar.date;


};

Calendar.setup(
{
flat : "calendar-container", // ID of the parent element
flatCallback : dateChanged // our callback function
}
);
</script>

and in my PHP form processor I had to add this to get the date formatted correctly:

$array['Date'] = date("m/d/Y",strtotime($array['Date']));

The calendar is awesome, just not functional for me at the moment. By the way, I know next to zero javascript, so that doesn't help.

Thanks in adavnce.

Google