Hi, and thanks for porting this module to D8.
I was trying to use the '#states' element property to conditionally hiding the element, but apparently this is ineffective.
Try the following in a form:
$form['cccenabled'] = [
'#type' => 'checkbox',
'#title' => $this->t('Enabled'),
'#default_value' => TRUE,
];
$form['ccc'] = [
'#type' => 'jquery_colorpicker',
'#title' => $this->t('Color'),
'#default_value' => 'FF00FF',
'#states' => [
'visible' => [
':input[name="cccenabled"]' => ['checked' => TRUE],
],
],
];
$form['ccd'] = [
'#type' => 'textfield',
'#title' => $this->t('Color'),
'#default_value' => 'FF00FF',
'#states' => [
'visible' => [
':input[name="cccenabled"]' => ['checked' => TRUE],
],
],
];
Cliking on the checkbox, the 'ccd' textfield visibility is toggled correctly, but the 'ccc' jquery_colorpicker is alyways shown.
AFAICS, the PHP side is correct, I suspect something in the JS side.
Comments
Comment #3
jaypanFixed in 8.x-1.3 (should be available in about five minutes)
Comment #4
mondrakeWorks great!
Thank you