Form Options States

Categories

Component ID

2879709

Component name

Form Options States

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

This module adds the ability to specify #states for individual options on Drupal Form API elements of the types: select, checkboxes, and radios.

This is an API module, with no user interface. You would only need this module if another module you are using requires it or if you are programming a custom form that needs #states on select children, individual radio buttons within a radios element, or individual checkbox elements within a checkboxes group element.

Usage
To add attributes to a form element's options, add an #options_states key to the form element definition. The #options_states value should be an array with keys that match the keys in the #options value array. The values in the #options_states array should be formatted like the main #states array.

Credit
The initial implementation of this module is a re-purposing of the very useful Form Options Attributes module.