Author Topic

Fraser Hore

Wednesday 21 December 2005 5:02:13 am

Comment45019

I realized that it's important to setup the calendar before the function as you did Paul. Otherwise you have to click on on the calendar date twice to get the calendar to close. So here is the right code for an ezdate attribute. I added an image instead of a button to call up the calendar. Have you had any luck in fixing the display of the calendar?

<img src={'popupcalendar_img.gif'|ezimage()} id="{concat('trigger',$attribute.id)}"
style="cursor: pointer; border: 1px solid blue;"
title="Date selector"
alt="Select Date"/>

{literal}
<script type="text/javascript">
Calendar.setup(
{
onSelect: OnSelectDate{/literal}{$attribute.id}{literal},
button : "trigger{/literal}{$attribute.id}{literal}"
}
);
function OnSelectDate{/literal}{$attribute.id}{literal}(calendar, date)
{
var year = document.getElementById("{/literal}{$attribute_base}_date_year_{$attribute.id}{literal}");
var month= document.getElementById("{/literal}{$attribute_base}_date_month_{$attribute.id}{literal}");
var day= document.getElementById("{/literal}{$attribute_base}_date_day_{$attribute.id}{literal}");
var date_array=date.split("/"); 

year.value=date_array[0]; 
month.value=date_array[1]; 
day.value=date_array[2]; 

if (calendar.dateClicked) 
{
 calendar.callCloseHandler(); 
} 
};
</script>
{/literal}