Skip to content

'filled' state isn't triggered when selecting a remembered field value #7024

@NormPlum

Description

@NormPlum

Description of the bug

When a form field uses states to show/hide itself based on the 'filled' value of a textfield, it doesn't work when you enter text into the textfield using the browser's remembered values in a drop-down.

It's hard to explain so see the video below.

Steps To Reproduce

To reproduce the behavior:

  1. Create a form with two fields - a textfield and a checkbox
  2. Use states on the checkbox to show it when the textfield is 'filled'
  3. Enter text into the textfield to see the checkbox appear
  4. Save the form
  5. Retry by selecting the saved form value for the textfield (instead of typing directly)

Actual behavior

Checkbox doesn't appear.

Expected behavior

Checkbox appears.

Additional information

filled_state.mp4

This video uses a form with the following code:

$form['module']['module_configure_path'] = array(
  '#type' => 'textfield',
  '#title' => t('Configuration page path'),
  '#placeholder' => t('admin/config/system/my-module'),
  '#indentation' => 1,
);
$form['module']['module_configure_file'] = array(
  '#type' => 'checkbox',
  '#title' => t('Put page callback in a separate file'),
  '#description' => t('The callback function that generates the page at the above configuration path will be placed into a separate `[module_name].admin.inc` file.'),
  '#indentation' => 2,
  '#states' => array(
    'visible' => array(
      ':input[name="module_config"]' => array('checked' => TRUE),
      ':input[name="module_configure_path"]' => array('filled' => TRUE),
    ),
  ),
);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions