# dynamic collection\_select

**URL:** <https://discuss.rubyonrails.org/t/dynamic-collection-select/47434>\
**Category:** rubyonrails-talk\
**Created:** [November 9, 2009, 4:44pm UTC](https://discuss.rubyonrails.org/t/dynamic-collection-select/47434 "2009-11-09T16:44:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [November 9, 2009, 4:44pm UTC](https://discuss.rubyonrails.org/t/dynamic-collection-select/47434/1 "2009-11-09T16:44:03Z")

</div>

Hello all, I'm very new to Ruby and web programming at all. I'm trying to get a page where I can have a series of drop downs that are all columns within the main table of my database. When you drop one down, and select a value, I want the others to update with their possible options based on the first selection. For example, the model is employees:

If you use the drop down for 'title', and select Vice President, then in the rest of the drop downs, the only options will be related to those who are VPs. I hope this makes sense. I just got the collection\_select to populate on my view, but I don't know where to go from here or how to pass that value back to a controller function.

I've read several blog posts and books, but they don't' seem to be addressing exactly what I'm doing. THANKS!

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [November 9, 2009, 5:35pm UTC](https://discuss.rubyonrails.org/t/dynamic-collection-select/47434/2 "2009-11-09T17:35:44Z")

</div>

I think you need AJAX here to populate the cascade "rest of the drop downs" or refresh the whole page on change of the first drop down and feed the collection\_seelct in the controller with appropriate data.

---

<div class="post-metadata">

**Author:** ![Eric9](https://avatars.discourse-cdn.com/v4/letter/e/ac91a4/32.png) [@Eric9](https://discuss.rubyonrails.org/u/Eric9)\
**Post date:** [November 9, 2009, 7:04pm UTC](https://discuss.rubyonrails.org/t/dynamic-collection-select/47434/3 "2009-11-09T19:04:49Z")

</div>

Typically for a form, with a "submit" button.

-eric
