Suppose this form:
<% form_for(@student) do |f| %>
<%= f.select(:subject_id,
options_from_collection_for_select(@subjects, :id, :name),
{:prompt => 'Select a subject' },
{:onChange => "#{remote_function(:update => :student_exam_id,
:url => {
:action => :update_exams_list,
:subject_id => 1
}
)
}" } ) %>
<%= f.select(:exam_id,
options_from_collection_for_select(@exams, :id, :title) ) %>
<% end %>
When user selects a subject, then exams selector list must be updated with exams belongs to selected subject.
How can I send subject parameter to controller? I tried to send parameter using :subject_id => 1
, but it does not work.
Please suggest me some ways to make this.
If you need more info, please ask me.
Thank you very much. Greetings.