colorbox: true on colorpicker embedded in a dhtmlxform.

Hi,

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.

Hi
If I understood you correctly, you will accept such example:
dhtmlx.com/docs/products/dht … _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); w1.center(); myForm = w1.attachForm(formData); cp = myForm.getColorPicker("status.offline.textColour"); inp = myForm.getInput("status.offline.textColour"); inp.value = ""; inp.style.backgroundColor = myForm.getItemValue("status.offline.textColour"); cp.attachEvent("onSelect",function(color){ inp.style.backgroundColor = 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.