Posted by cprofessionals on April 17, 2020 at 2:26am
This is not so much of a "Discussion" as a documentation of the resolution from todays meeting and an VERY appreciative "THANK YOU" to Jennifer for her mentorship. Jennifer, YOU ROCK!
Here was my solution for "ajax-ish" state detection on a Managed_File element within a Drupal Form.
$form['entity_ajax']['entity_type'] = array(
'#title' => t('Entity Type'),
'#type' => 'select',
'#description' => 'Select the entity type to import.',
'#options' => array_combine($entity_types, $entity_types),
'#empty_option' => t($this->select_verbiage),
'#default_value' => '',
'#value' => $this->entity_type ,
'#states' => array(
'invisible' => array(
':input[name="import_file[fids]"]' => array(
'empty' => TRUE,
),
),
),
);
Comments
Woot!
Glad you got it working -- yeah, that #states feature is cool!
--Jennifer
Drupal programmer - http://poplarware.com
Drupal author - http://shop.oreilly.com/product/0636920034612.do
Drupal contributor - https://www.drupal.org/u/jhodgdon