knackforge
April 8, 2012
Drupal introduced a new form element attribute called 'states'. This adds Javascript to change the state of an element based on another element. The state denotes the property of a form element, for eg. visible, enabled, and so on.
Common states
Example
Let us assume that we have a field so-called 'field_user_group' ( list type ) in some form with values gold, silver, bronze and we want to alter the display of field 'field_user_discount' ( text ).
The discount field will be disabled when field_user_group has a value of 'gold', enabled when the value is 'silver', and invisible when the value is 'bronze'.
The value might involve even checkbox status like below,
Just like how your fellow techies do.
We'd love to talk about how we can work together
Take control of your AWS cloud costs that enables you to grow!