views:

27

answers:

1

Dear All, View

<form align="center" name="gm" action="">
 <label for="col1"><b>Name: </b></label> 
 <%= collection_select(@table, "gm", @pop1, "col1", "col1", :prompt => true) %>
 <%= submit_tag value="Proceed-->"%>  
 <form name="sp" action="">
  <label for="col2"><b>Class: </b></label>
  <%= collection_select(@table, "sp", @pop2, "col2", "col2", :prompt => true) %><br><br>
   <%= submit_tag value="Submit"%>  
</form>

Here, these are relational collection_select. I need to populate the second collection_select once first collection_select was selected. But, once "Proceed" submit was processed, params[gm] was disabled. So I am unable to process "Submit" tag with both params[gm] and params[sp] for @table. Any idea to keep selected value in collection_select to remain after click "Proceed".

A: 

If I use

<%= collection_select(@table, "gm", @pop1, "col1", "col1", :prompt => true, ;selected=> params[:gm]) %>

It works!

Palani Kannan