Issues with colorpicker & null values

Hello,

I’m trying to load a color value (in hex, e.g. “abcdef”, without the “#”) from the database.
myfrm.load(“loadValues.php”); loads the values into “myfrm”. In “loadValues.php” I use the ->renderSQL(); method to load and render the data into my form.

Now, two issues arise by doing this.
1st - The colorpicker won’t be filled. I tried to fill the colorpicker in an empty form by using:
frm.getColorPicker(“mycolorpicker”).setColor("#abcdef"); - this didn’t set the value in the colorpicker.

2nd - I also use Calendar objects, so the user can enter dates easily. Now, the problem that arises here is that a “null” value in the database will cause JavaScript to abruptly stop parsing due to a null exception. This error is thrown in dhtmlx.js.

Those errors are not intertwined (because the order of the objects does matter, everything behind “null” is not rendered, everything before “null” is actually a-ok).

How can I solve these issues?

A quick recap:
after .load() ;in JavaScript a PHP file is called. The PHP file responds with the return value of ->renderSQL(); which the JavaScript interprets. The ColorPicker is not set and if a Calendar object is null, dhtmlx.js throws a null exception (and stops).

Can you provide us a direct link to youк project, or doungrade an application and make a completed demo to reproduce the issue?

Hi

  1. regarding color picker

myForm.getColorPicker(colorpicker_name).setColor(“#000000”);
set color inside color picker, but input still contain old value.
when you click input to show colorpicker - it shows color from input.
for this - use:
myForm.setItemValue(colorpicker_name, “#000000”);

  1. regarding calendar - please use attached updates
    updates.zip (145 KB)

Hi,

thanks a lot for your reply. Now while I can update the colorvalue, the attached update doesn’t work… Unfortunatly!

The null value occurs in the file dhtmlx.js, not in any files directly related to calendar.

Here is an example of code:

details.js – pastebin.com/dPZgi0g8
birthday.php – pastebin.com/9ZpBvHA2

Correct, calendar (and ther components) are located in dhtmlx.js
I sent you updates for calendar only, just include them on page after dhtmlx.js