title: How to create dropdown list values depending on previous input?
body: <p>I need some help on rails forms. I currently have:</p>
  
  <pre><code>&lt;div class="field"&gt;
    &lt;%= f.label :student_id %&gt;
    &lt;%= f.collection_select(:student_id, Student.active.order('first_name'), :id, :proper_name, :prompt =&gt; true) %&gt;
  &lt;/div&gt;
  &lt;br /&gt;
  &lt;div class="field"&gt;
    &lt;%= f.label :section_id %&gt;
    &lt;%= f.select(:section_id, get_section_list, :prompt =&gt; "Select Section") %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>So the first drop down is to select a student. The second drop down list is to select a section. However, right now I am displaying all sections. But I want to only the select those sections that the student is eligible for. So how do I get the input of the first drop down list in order to change the second drop down list options. If they try to choose the section without selecting a student, it should show all the options.</p>
  
  <p>Thanks!</p>