Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Mirkozzo on
In my custom module i use #states to show a text field when boolean field value is 1.
I can not use #states with a taxonomy field
My code:
WORK
function my_module_form_alter (&$form, &$form_state, $form_id) {
$form['field_my_text']['#states'] = array(
'visible' => array(
':input[name="field_my_boolean[und]"]' => array ('value') => 1),
),
);
}
.
.
DON'T WORK
function my_module_form_alter (&$form, &$form_state, $form_id) {
$form['field_my_text']['#states'] = array(
'visible' => array(
':input[name="field_my_taxonomy[und]"]' => array ('value') => 15),
),
);
}
I tried:
('value') => 'my_term_name')
('tid') => '15'
but don't work
Comments
The problem is shs module.
The problem is shs module.
how can I use #states with shs widget?