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.
Paul F. (Guest)
on 2008-11-26 16: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
Paul F. (Guest)
on 2008-11-28 17:28
Can anyone help me this?
pepe (Guest)
on 2008-12-01 04:13
(Received via mailing list)
Have you heard of observe_field?

Pepe

On Nov 28, 10:28 am, Paul F. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.