I'm building a custom dependent dropdown form with 2 select inputs.
I've managed to build the form inputs and update them accordingly, but I'm not able to get the dependent select's value in the submit hook.
I think this happens because I changed (via
$form in the AJAX callback, and as such, the second input values aren't updated in the
My problem is that I have no simple way of knowing which options will be available either in the first-level select nor in the dependent select, since they come from a 3rd-party API.
Is there any way I can trigger the update of the
#options in the dependent select, without having to render the nested dropdown and changing the
$form so that the nested values are available in the
Or, alternatively, is there anyway I can update the
$form_state so that it knows the newly added
#options of the second select?