colorbox: true on colorpicker embedded in a dhtmlxform.


Just wondering if this is possible.

I have a form that I’m creating using JSON, and inside it, some a colorpicker field.

I want the background color of the field to be the same as the value.

If I understood you correctly, you will accept such example: … _html.html

My form is created like:

form = window.attachForm([ { type: 'colorpicker', name: 'status.offline.textColour', width: 55, imagePath: colorpickerimgpath } ]);

And I want to be able to add ‘colorbox’ to it.

Based on your code, there is a new suggestion:

function doOnLoad() { formData = [ {type: 'colorpicker', name: 'status.offline.textColour', width: 55, imagePath: "../dhtmlxColorPicker/codebase/imgs/", value: "#FF8C00"} ]; dhxWins = new dhtmlXWindows(); dhxWins.enableAutoViewport(false); dhxWins.attachViewportTo(document.body); w1 = dhxWins.createWindow("w1", 10, 10, 350, 300);; myForm = w1.attachForm(formData); cp = myForm.getColorPicker("status.offline.textColour"); inp = myForm.getInput("status.offline.textColour"); inp.value = ""; = myForm.getItemValue("status.offline.textColour"); cp.attachEvent("onSelect",function(color){ = color; inp.value = ""; }); }

Thanks, that looks great.

I think I’m using an older version, because that function doesn’t exist. So I’ve tried to add it from my script (Rather than just editing dhtmlxform.js).

I’ve got:

dhtmlXForm.prototype.items.input.getInput = function(item) { return item.childNodes[1].childNodes[0]; }; dhtmlXForm.prototype.getInput = function (id) { return this.doWithItem(id, "getInput"); };

But I keep getting an error:

Please provide completed demo including all needed js/css files to reproduce issue localy.