Article
Posted on 17th January 2017
Takes about 2 mins to read

I've previously written about dynamic forms in Drupal, using #states to show or hide input boxes depending on other inputs. Since then, Drupal 7 and 8 have both got the ability to combine conditions with OR and XOR operators. This makes it possible to apply changes when a form element's value does not equal something, which is not obvious at all.

Article
Posted on 5th July 2011
Takes about 2 mins to read

Here's a quick follow-up to my original post on Dynamic forms in Drupal 7, as a reply to Wappie08, who asked me about combining conditions in the #states array to add increased control over the display of your form elements. The question: Hi James Williams, I read your blog post about d7 & #states in the FAPI which is really cool! One problem is that the information is also listed in the drupal.org example module...

Article
Posted on 28th January 2011
Takes about 2 mins to read

When building forms, you will often want to only provide certain options if other options are chosen by a user. For example, there's no need to show the 'open link in new window' checkbox, if the 'make this into a link' checkbox hasn't been ticked. These kinds of dynamic forms haven't been easily available for Drupal... until now, with the #states for form elements in Drupal 7. Take a peek at this example of dynamic...