Problems with calendar attached to a text input

I have a calendar which attached to a text input. I want to keep text input editable and want to popup calendar when a button/icon is clicked and then set the date in text input. I got the following code but, when I click on calendar image, I get javascript error:

this.parent is null

onMonthSelect()()dhtmlxcalendar.js (line 84)

(?)()()edit (line 1176)

[Break on this error] this.onLanguageLoaded(status)};function…ct = function(value) {if (!isNaN(value))

My code:


There are some mistakes in your code:

1) method draw() isn’t called. This method is necessary:




2) This code calls body onclick - and calendar closes.

Thanks for the reply!
Making suggested change won’t work either.
$(‘cal_container_10’).hide();// hide the container

now in onClick I call
$(‘cal_container_10’).show(); calendar won’t show. I also tried calling but clicking on icon won’t show the calendar. I don’t get any javascript errors now.

function openCalendar_10() {

 //cal_10.isVisible() ? cal_10.hide() :;

In my previous reply I’ve written about two mistakes in your code. Please, check the 2) once again.

You don’t cancel bubbling in the onclick event handler of the image. That is why the body onclick event handler is called (dhtmlxEvent(document.body,“click”,function(){ cal_16.hide(); }):wink: - calendar closes.


The example that ‘Anonymous’ wanted to implement is valid. We’re trying to do the same thing, with the same results.

Can you provide a simple example that ties a text to a calendar, but that has a small calendar image that when clicked opens the calendar?

Clicking on either the text, or the image, to open the calendar helps with usability. The user knows what behaviour to expect, when he see this text/calendar icon pair.




take a loot at the attached sample (37.8 KB)