I use Ctools Dependency to make a set of fields hidden. This is part of my code:
$form['profile-status'] = array(
'#type' => 'radios',
'#title' => '',
'#options' => array(
'new' => t('Create a new profile.'),
'select' => t('Use an existing profile.'),
),
);
$form['select'] = array(
'#type' => 'select',
'#title' => t('Select a profile'),
'#options' => $options,
'#process' => array('ctools_dependent_process'),
'#dependency' => array('radio:profile-status' => array('select')),
);
$form['profile-properties'] = array(
'#type' => 'fieldset',
'#title' => t('View the profile'),
'#process' => array('ctools_dependent_process'),
'#dependency' => array('radio:profile-status' => array('select')),
'#input' => true,
);
In the snippet above, there are two elements, one selection and one set of fields. Both have #process and #dependency parameters and both point to the same field for the dependent value. The problem is that elements such as select or a text field can be easily hidden, but this does not work for a set of fields. In this support request page , the creator of CTools noted that '#input' => true- this is work. As you can see, I added it to the code, but it does not work.
Do you have any suggestions?
source
share