I've implemented colorpicker in one of my modules, however, I have recently come up against an issue where the colorpicker_textfiled and colorpicker do not link themselves together. I've narrowed the problem down to setting #tree = true on one of the form elements parents.
$form['attributes'] = array(
'#type' => 'markup',
'#value' => ' ',
'#tree' => TRUE, //the offending line
);
$form['attributes']['Color']['color00_colorpicker'] = array(
'#type' => 'colorpicker',
'#title' => t('Color 00'),
);
$form['attributes']['Color']['color00'] = array(
'#type' => 'colorpicker_textfield',
'#default_value' => ($attributes['color12'] ? $attributes['color12'] : '#A186BE'),
'#colorpicker' => 'color00_colorpicker',
);
When #tree is false the id of the colorpicker text field is "edit-color00", but when #tree is true, the id changes to "edit-attributes-Color-color00"
Comments
Comment #1
aaron1234nz commentedDon't worry, solved it.
I needed to write
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.