Hi All,
When adding new elements to an existing form via AJAX using hook_form_alter, for example, clicking a checkbox adds a datefield input, hoping someone can point me in the right direction as I think the below approach seems too hacky.
It's in a .module file, so no class to set vars, so am using user input to define how the element should render.
The approach below works, however can anyone point me in the direction for the "correct" way to do this.
Removed the bulk of the code so only the relevant code is here in this post.