I have a form where I dynamically add form elements based on user input.
An example is that when a user selects a “server” from a select box I
add (via AJAX calls back to server) a “type” select box pre-populated
with valid choices for that server. I do this by using observe_field on
the “server” field and update a div on the page with the new “type”
select box. So far so good. The form submits with all the proper
Now I want to watch the newly added “type” field with observe_field but
it doesn’t work. I never see the callback function specified in
observe_field get called. It seems like since the element didn’t exist
when the page initially loaded the observe_field can’t watch the
element. I also tried updating/adding the observe_field code when I
create the new “type” select box but that also doesn’t work.
I can whip up an example if ppl need to see it in code but it is rather
difficult to extract it cleanly from my current code.