Forum: Ruby on Rails Populate a popup menu based on another menu selection

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8b1314e1e15781e22f9bdef89117c752?d=identicon&s=25 Paul Finer (paulfiner)
on 2008-11-26 15:39
I'm just getting started with RoR and need some help with setting up the
following scenario.

I have three models:- Jobs, Clients and Contacts

A job has one Client which, in turn, has many contacts.

When I'm creating a new job I would like a popup menu so the user can
choose the client.
Having done this, I would then like another popup menu to only show the
contacts
for the client selected.

I have the first popup done using:-

<%= select("client","client_id", Client.find(:all).collect {|c| [c.name,
c.id]}) %>

I'm stuck on how I would populate the contacts menu based on the client
selection.

Any help would be much appreciated!

Cheers

Paul
8b1314e1e15781e22f9bdef89117c752?d=identicon&s=25 Paul Finer (paulfiner)
on 2008-11-28 16:28
Can anyone help me this?
10f7e00c1c5c60e2173995eb16f4ffc7?d=identicon&s=25 pepe (Guest)
on 2008-12-01 03:13
(Received via mailing list)
Have you heard of observe_field?

Pepe

On Nov 28, 10:28 am, Paul Finer <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.