Error in dhtmlxtoolbar.js when using toolbar.setvalue on a t

I have two sliders in a toolbar ando two input boxes.
I have attached ‘onEnter’ and ‘onValueChange’ events to the toolbar.
I use these to manipulate the values since the value of the slider and the input boxes are two ways for selecting the values.

When I change the value for a slider using toolbar.setValue(‘edate_slider’, enteredDay, true) nothing happens, the value of the slider is not changed. Firing up the debugger results in a error on line 126 in dhtmlxtoolbar.js :

TypeError: Result of expression ‘this.idd’ [undefined] is not an object.

If I replace the true with false : toolbar.setValue(‘edate_slider’, enteredDay, false) , the sider is changed, but the other slider is not automatically changed since the code for this is not triggered.

Is the problem resulting from the fact that I trigger an event from within another event handler for the same toolbar ?

Could you provide the demo where we can reproduce the problem. It is not clear from the description.

I have now set the flag for triggering the events to ‘false’.
It is in /dhtmlx/test/js/init.js

Lines 111 -155.

Thanks for taking a look at it.

There are the incorrect xml errors in your sample. I’ve tried making demo - the same approach works correct to set a slider value. (70.7 KB)

Thanks, but the issue is in the part that handles the event for the inputboxes ‘sdate’ and ‘edate’ :
toolbar.attachEvent(“onEnter”, function(id, value)

toolbar.setValue(‘sdate_slider’, enteredDay, false);
* the true flag throws and error, so modify the start dates manually.
toolbar.setValue(‘edate_slider’, ++enteredDay, false);
toolbar.setValue(‘edate’, ‘2010-05-’ + enteredDay);

Here I wanted to use the option ‘callEvent’ of the setValue method, in order to let the ‘toolbar.attachEvent(“onValueChange”, function(id, value)’ event handler set the sliders and inputboxes for me.

You can ignore the xml errors.
They are for filling the menu tree and the grid below the toolbar.
The toolbar is not linked to any external input nor does it generate any output.

Methods those set value don’t call events. It is common for all our components. You may call the necessary function manually, there is no need in event in this case:

toolbar.setValue(‘sdate_slider’, enteredDay, false);


OK, thanks for the info.

But the manual for “Setting Slider’s Value” states :
toolbar.setValue(id, value, callEvent)
The parameters are as follows:
id - id of the item;
value - the new value;
callEvent - true|false, if set true, calls onValueChange event.

This is what I wanted, so I do not have to duplicate code to get the sliders changed.

Yes, there is a bug in the setValue method. I’ve attached the fixed toolbar (13.1 KB)


The new version fixed it.