Collection_text onchange event

hi,

I want to display a drop down list and when i select some option from
the drop down list i want to display all the records under that selected
category in the “SAME PAGE”…

eg …

<%= collection_select(:question,:subject_id ,@subject, :id, :name) %>

when i choose a subject i should, display all the questions under that
subject in the same page.I am new to rails.Can anyone please help me
out…

Thanks in advance

Hi

Have a look at observe_field

http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M001654

Sijo

Sijo Kg wrote:

Hi

Have a look at observe_field

http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M001654

Sijo

Hi, i tried like this,

View page:

<%= collection_select(:question,:subject_id ,Subject.all, :id, :name )
%>
<%= observe_field ‘question_subject_id’,
:url => {:controller=>‘question’,:action => ‘subject_action’}, :with
=> ‘subject_id’ %>

Controller:

i tried checking if it comes to the controller… the controller method
is not even called. Please help me to find the mistake

def subject_action
render :update do |page|
page.alert “hello from update items call!!”
end
end