Drupal: How to make a fieldset dependent using CTools
Posted
by far
on Stack Overflow
See other posts from Stack Overflow
or by far
Published on 2010-06-16T08:28:33Z
Indexed on
2010/06/16
8:32 UTC
Read the original article
Hit count: 229
drupal
Hello,
I am using Ctools Dependency to make a fieldset hideable. 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 snippet above, There are two elements, one select and one fieldset. Both have #process and #dependency parameters and both point to one field for dependent value. Problem is elements like select or textfield can be hidden easily but it does not work for fieldset. In this support request page, CTools creator has mentioned that '#input' => true
is a work around. As you see I added it to code, but it does not work as well.
Do you have any suggestion?
© Stack Overflow or respective owner