Select_tag question


#1

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