---
title: "Drupal Form API States"
url: "https://michalak.world/posts/drupal-form-api-states/"
description: "Drupal 9 Patch htaccess with Composer"
summary: "Drupal 9 Patch htaccess with Composer.\""
date: 2024-10-16
lastmod: 2026-08-19
tags: ["Drupal","Drupal 10","Drupal 9","Drupal 8","Drupal 7","Form API","API"]
section: "posts"
author: "Michael Michalak"
site: "https://michalak.world/"
---

# Drupal Form API States

Drupal 9 Patch htaccess with Composer

Drupal form API states can support multiple values.  

E.g.
```
$form['field_something']['#states'] = [
  'visible' => [
    ':input[name="field_else[0][target_id]"]' => [
      ['value' => 'one'],
      ['value' => 'two'],
      ['value' => 'three'],
      ['value' => 'four'],
    ],
  ],
];
```
This also applies to:
- Drupal 7
- Drupal 8
- Drupal 9
- Drupal 10

