Calender does not disappear

Hi there,

Basically, what I’m trying to do is quite simple. As you’ll see in the screenshot below, I’m trying to have the calendar appear and disappear when someone clicks on the righthand icon of the text input.

function on_hyperlink_click()
{
	//object.isVisible = !object.isVisible;
	alert("");
	if (calendrier.isVisible())
		calendrier.hide();
	else
		calendrier.show();
	
	alert(calendrier.isVisible());
}

......


<input type="text" id="dateDebutPeriodePlan" />
    		<div style="position:absolute; margin-left:-19px; margin-top:4px; display:inline">
    		<a href="javascript:on_hyperlink_click();"><img src="img/calendar.gif" border="0" /></a>
    		</div>

The problem here is that the act of clicking on the icon when the calendar is visible closes the calendar before the toggling function has a chance to run (confirmed by the empty ‘alerts’ placed at the start of the function). So naturally, the calendar, once visible, never disappears since it’s always hidden by the time I check. Is there something I can do to fix this?

Thanks in advance,

Osu

Hello,

Try to init calendar w/o input assignation,
dhtmlx.com/docs/products/dht … _init.html

Thanks for the pointer Andrei, I’ll give it a shot later today. In the meantime, I found a workaround with the mouseup event. By trapping the “mouseup” event and checking whether the calendar was visible at that time, I was able to circumvent the problem. But your solution sounds way more simple than mine.

Thanks again.

Osu