Form values not included in submit when ajax generated

Hi.

I have a form with two select lists, named ‘project’ and ‘activity’. The
content of the ‘activity’ list is changed when the selected item in
project changes, using ‘observe_field’ where project is observed, and a
div enclosing ‘activity’ is updated. This works as expected. The problem
is that when submitting the form containing the two select list after
they have changed, the value of the selected ‘activity’ item is not
included in the submitted values. If no change in the selects has
occurred since the page was originally loaded, the value for ‘activity’
is included, because the activity list is not generated by the
‘observe_field’ the first time.

So I guess the reason that the value of the ‘activity’ select is missing
is because it is generated by a Ajax call after the form is originally
loaded, but how can I have the value of the selected ‘activity’ to be
included in the submitted values? Any ideas?

André