dynamic form problem

Jedrin
Thu, 24 Sep 2009 20:45:09 -0000

I have a form that when a user changes a selection field
''data_fmt''
to a certain value, then a different selection ''data_level''
has a
different set of available selections drop downs and a check box field
may appear or disappear depending on the selection in
''data_fmt''.

I like to use form_remote_tag so that when there was an error, I just
display an alert() message. In the above scenario however, I thought
of using observe_field and having div tags which have
style=''display:none'' and making them appear or disappear as
needed,
but it seems like that approach may not work inside of a form ?

 If I use observe_form and try to re render the form every time it
changes, it works pretty good except when the user starts to enter
text in a text field, the re render causes the focus on that field to
be lost. It seems maybe I just need to figure out how to re set the
focus unless this problem has a better approach ..

 A similar approach using observe_field causes some of the text fields
to lose their values on re render.