# Dropdown select

**URL:** <https://www.ruby-forum.com/t/dropdown-select/76175>\
**Category:** Rails\
**Created:** [November 16, 2006, 2:41pm UTC](https://www.ruby-forum.com/t/dropdown-select/76175 "2006-11-16T14:41:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 16, 2006, 2:41pm UTC](https://www.ruby-forum.com/t/dropdown-select/76175/1 "2006-11-16T14:41:50Z")

</div>

I have a act\_as\_tree model ,I want to show it in several select  
box,the height of the tree is unknow ,and can be different,how can I do  
this in AJAX? Just like I select a country in a select box,the coming  
select box is to select a state,but my case is more complicated.  
Thx

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 16, 2006, 5:36pm UTC](https://www.ruby-forum.com/t/dropdown-select/76175/2 "2006-11-16T17:36:38Z")

</div>

removed\_email\_address@domain.invalid wrote:

> I have a act\_as\_tree model ,I want to show it in several select  
> box,the height of the tree is unknow ,and can be different,how can I do  
> this in AJAX? Just like I select a country in a select box,the coming  
> select box is to select a state,but my case is more complicated.  
> Thx

You may be able to do some cascading select boxes, but you probably  
should consider using an autocomplete field instead (depending on your  
data).

See…

[http://www.sciwerks.com/blog/2006/09/13/cascading-selects-vs-auto\_complete/](http://www.sciwerks.com/blog/2006/09/13/cascading-selects-vs-auto_complete/)  
and  
[http://www.sciwerks.com/blog/2006/07/07/updating-select-controls-with-ajax/](http://www.sciwerks.com/blog/2006/07/07/updating-select-controls-with-ajax/)

\_Kevin

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 17, 2006, 3:44am UTC](https://www.ruby-forum.com/t/dropdown-select/76175/3 "2006-11-17T03:44:55Z")

</div>

THX!  
I read the post of ‘Updating ‘select’ controls with AJAX’,that’s  
very helpful.I’ve done this by adding :onChange =\> "new Ajax.Updater in  
my view but not krjs,that’s more complicated but it works.now I have  
an unknow depth of tree of the model .that’s I don’t how many select  
box should be placed in the view.then how to ?
