Skip to main content


Drupal Forms using ajax breaking dependency injection

Recently, I was building a custom Drupal form that used dependency injection and included an ajax submit handler. While testing the form, on the initial page load, the form submitted just fine using ajax. However, when the user used another ajax handler on the same form, all of the injected services were set to `NULL`.

Multi-dependent select elements in Drupal 7 using ajax

Recently I needed to modify a Drupal 7 node form to have two drop down select elements populate based upon a third select element's choice. I have altered select elements in the past to have a single dependency, but never have I made one element control the content of two different elements.

To start, I made the first element control the second (the old familiar way):

I need the selection in field_dropdown_1 to dictate what appears in the list for field_dropdown_2 and field_dropdown_3.