# Populate a popup menu based on another menu selection

**URL:** <https://www.ruby-forum.com/t/populate-a-popup-menu-based-on-another-menu-selection/154223>\
**Category:** Rails\
**Created:** [November 26, 2008, 3:39pm UTC](https://www.ruby-forum.com/t/populate-a-popup-menu-based-on-another-menu-selection/154223 "2008-11-26T15:39:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/eb9ed0/32.png) [@paulf](https://www.ruby-forum.com/u/paulf)\
**Post date:** [November 26, 2008, 3:39pm UTC](https://www.ruby-forum.com/t/populate-a-popup-menu-based-on-another-menu-selection/154223/1 "2008-11-26T15:39:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![paulf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/eb9ed0/32.png) [@paulf](https://www.ruby-forum.com/u/paulf)\
**Post date:** [November 28, 2008, 4:28pm UTC](https://www.ruby-forum.com/t/populate-a-popup-menu-based-on-another-menu-selection/154223/2 "2008-11-28T16:28:31Z")

</div>

Can anyone help me this?

---

<div class="post-metadata">

**Author:** ![paulf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/eb9ed0/32.png) [@paulf](https://www.ruby-forum.com/u/paulf)\
**Post date:** [December 1, 2008, 3:13am UTC](https://www.ruby-forum.com/t/populate-a-popup-menu-based-on-another-menu-selection/154223/3 "2008-12-01T03:13:40Z")

</div>

Have you heard of observe\_field?

Pepe

On Nov 28, 10:28 am, Paul F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
