I fixed my problem.
The problem was that the form_for helper was after the html <table>
tag and before the <tr> tag. Because of that the form element for the
second dropdown was somehow not being considered part of the form.
Once I moved the form_for helper before the <table> ta everything was
fine. Hope somebody else can benefit from this.
On Mar 24, 3:24 pm, "njs"
<navje...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I am trying to create a dynamic select box (contact_preferences
> options list) based on a selection made in another select box (user
> contact_preference_opt_in). I am using form_for to build the form that
> has user contact_preference_opt_in select box. The contact_preferences
> options list select box is in a partial. I use observe_field on first
> select box which calls an action (passes the selected value to it) to
> build an array used to populate the second drop down. All this works
> well but when I submit the form the second select box selection is not
> sent in the form (params).
>
> Currently I am using the select helper (e.g.
> select(:user, :contact_preference, @preferences) where @preferences
> array is populated in the action. Can I use this inside form_for
> rather than f.select?
>
> Seems like I can''t use f.select way of populating the select box
in
> the partial as it does not know about the context of variable f when
> the partial is called from the action.
>
> This should be common problem and I must be doing something wrong here.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---