The best way to do this is to use the observe_field method.
Basically, you want to do this: (in the view)
Create a drop down:
<%= collection_select :user, :favorite_color, @colors, "id",
"name %>
then somewhere below that, create an observe_field
<%= observe_field "user_favorite_color", :action =>
"do_something" %>
For more information, lookup collection_select and observe_field in
your favorite rails api format. I am partial to railsbrain:
collection_select:
http://railsbrain.com/api/rails-1.2.4/doc/index.html?a=M001655&name=collection_select
observe_field:
http://railsbrain.com/api/rails-1.2.4/doc/index.html?a=M001683&name=observe_field
On Nov 11, 2007, at 9:54 PM, artybala wrote:
>
> Hi.,
>
> Need help in learning how to submit a Form when a drop down value
> changes. I am using form_remote_tag . I want detail rows to be
> retrieved below automatically based on the value selected. ( Ex:
> Automatically list the students when you select the school name from
> the dropdown) . I am able to do it when I explicitly submit it using
> the submit_tag , but I want the form to be submitted as soon as the
> value changes with having to use the submit button. I am a newbie to
> Rails and would truly appreciate the help.
>
> Thanks.
> Artybala
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---