hi :)
i want to know how can i put multiple color pickers in my form, i need 3 color pickers, i put the 3 color pickers in my form but, if i have more than one color picker they have no effect.
sorry my bad english, and thanks by the help :)

Comments

thiagomoraesp’s picture

hi guys :)
i solved it.
we need to use the #colorpicker value as the colorpicker name in the colorpicker_textfield something like:

$form['cabecalho']['cor_de_fundo']['colorpickerfundo'] = array(
'#type' => 'colorpicker',
'#title' => 'Cores',
'#description' => 'seletor de cores',
//the id of my colorpicker is 'colorpickerfundo'

);

$form['cabecalho']['cor_de_fundo']['cor_do_fundo'] = array(
'#type' => 'colorpicker_textfield',
'#title' => 'Cor do Fundo',
'#default_value' => '#000000',
'#description' => 'cor',
'#colorpicker' => 'colorpickerfundo', //the #colorpicker propierty need to be equal the colopicker name.

i hope it be very usefull for somebody, i search a lot about this is the internet but i don't find anything.
);

dwees’s picture

Component: User interface » Documentation

Yes, that's exactly correct. Good deduction, looks like we need better documentation in the README.

thiagomoraesp’s picture

Status: Active » Fixed

for more details, the module have a folder that have samples of this :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.