Hello
Is it possible to attach a colorpicker to a form.
Maybe there’s a sample availabe?
Hello
Is it possible to attach a colorpicker to a form.
Maybe there’s a sample availabe?
Does anyone know of this is possible?
Hello,
All you have to do is:
<script src="dhtmlxform/codebase/ext/dhtmlxform_item_colorpicker.js"></script>
<script src="dhtmlxColorPicker/codebase/dhtmlxcolorpicker.js"></script>
<link rel="stylesheet" type="text/css" href="dhtmlxColorPicker/codebase/dhtmlxcolorpicker.css">
formData = [
{type: "colorpicker", name: "Color", label: "Color:", value: "#345abc", imagePath: "dhtmlxColorPicker/codebase/imgs/"}
];
Thanks for your reply. I have a colorpicker on my form now.
But when in the examples the inputfield is filled with the selected color,
but on my form the color stays white.
Is there a solution for this?
In the examples there is a parameter colorbox.
But when I use colorbox = “true”, nothing happens.
I also want to change the position where the colorpicker appears.
Does someone have solution for this?
Hello,
when in the examples the inputfield is filled with the selected color,
but on my form the color stays white.
To fill inputfield with color just add a value with needed color as one of the parameters:
value: “#345abc”.
See the example:
formData = [
{type: "colorpicker", name: "Color", label: "Color:", value: "#345abc", imagePath: "dhtmlxColorPicker/codebase/imgs/"}
];
In the examples there is a parameter colorbox.
But when I use colorbox = “true”, nothing happens.
Unfortunately colorbox attribute is not available in form.
Here is all available attributes of colorpicker in form:
So if I read the attributes correctly it’s not possible to set the selected color in the inputfield and it’s also not possible to change the position where the colorpicker appears.
About colorbox: yes, it’s not available.
About position on page:
You may try to get dhtmlxColorPicker instance.
With help of such method:
var dhxColorPicker = dhxForm.getColorPicker(name);
You can use all methods that are conected to dhtmlxColorPicker.
docs.dhtmlx.com/doku.php?id=dhtm … _toc_alpha
Including ‘setPosition(x,y)’:
docs.dhtmlx.com/doku.php?id=dhtm … etposition
By the way you may try to experiment with linkTo method of colorPicker to achieve the setting color to input.
docs.dhtmlx.com/doku.php?id=dhtm … ker_linkto
Here is the example of using of this method:
dhtmlx.com/docs/products/dht … _link.html
I don’t get it working.
The color in the input field would be nice if it would work, but the position problem is necessary for me te fix. Because the whole form is translated when the colorpicker is opened. A part of the form will be out of the screen then.
Try to add this into your sample
dhxColorPicker = myForm.getColorPicker("name_of_colorpicker");
dhxColorPicker.attachEvent("onShow",function(){
dhxColorPicker.setPosition(10,20)
})
Yes that works, thanks a lot!
Maybe you have an example with linking a colorpicker on a form?