# Select\_tag question

**URL:** <https://www.ruby-forum.com/t/select-tag-question/160858>\
**Category:** Rails\
**Created:** [February 20, 2009, 11:59am UTC](https://www.ruby-forum.com/t/select-tag-question/160858 "2009-02-20T11:59:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![on9west](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/6f9a4e/32.png) [@on9west](https://www.ruby-forum.com/u/on9west)\
**Post date:** [February 20, 2009, 11:59am UTC](https://www.ruby-forum.com/t/select-tag-question/160858/1 "2009-02-20T11:59:21Z")

</div>

Dear all

I want to create two select\_tag in view, the second select\_tag will  
depend on the first select\_tag values.

i.e. If the first select\_tag selected AHN, then the second have value  
[CPS,HMS,MBS,BBS] for selection. If the first select\_tag selected NDH,  
only [ABS,CPS] is available in second select\_tag. I have no idea how to  
implement this. Please give me some advices. Thank you.

tables  
column\_1 column\_2  
AHN CPS  
AHN HMS  
AHN MBS  
AHN BBS  
NDH ABS  
NDH CPS  
PWH CPS  
PWH MBS  
PWH CRS

enquiries controller  
@column\_1= Table.find(:all).collect {|x| [x.column\_1, x.column\_1]}.uniq

view/enquiries  
\<% form\_tag do %\>  
\<%= select\_tag(:column\_1, options\_for\_select(@column\_1)) %\>  
\<%= select\_tag(:column\_2, #How to do here?) %\>  
\<%= submit\_tag “search” %\>  
\<% end %\>

Many thanks

Valentino
