Author Topic

Fraser Hore

Tuesday 20 December 2005 1:51:14 am

Comment45007

Ok I got it to work, sort of.

I tried the following code in my ezdate override template and it seems to work, but only for the last of several date fields in my content class. I can still pick the year, month and day individually in the other date fields but in the last one, it will properly update all fields no matter which one i happen to select to bring up the calendar. Anyone have any ideas to get this to work for all the date attributes in my class?

The Code:

{literal}
<script type="text/javascript">
function catcalc(cal) {
var date = cal.date;
var input_field_year = document.getElementById("year");
input_field_year.value = date.print("%Y");
var input_field_month= document.getElementById("month");
input_field_month.value = date.print("%m");
var input_field_day= document.getElementById("day");
input_field_day.value = date.print("%d");
};
Calendar.setup(
{
inputField : "year",
ifFormat : "%Y",
onUpdate: catcalc
}
);
Calendar.setup(
{
inputField : "month",
ifFormat : "%m",
onUpdate: catcalc
}
);Calendar.setup(
{
inputField : "day",
ifFormat : "%d",
onUpdate: catcalc
}
);
</script>
{/literal}