Topic: Drop down list and pass value

Hi guys,

spent so many hours now on this little step, hope you can help me.

I just wan't to call a method and pass a parameter to it after sth. in the list is selected.
But i just don't get any reaction when i choose a field in the list.

I tried this:

<%= collection_select('material', 'id', @materials, :id, :substance ,{}, 
:onchange => remote_function(
:url => { :action=> :view })) %>

and this:

 <%= collection_select('material','id', @materials, :id, :substance,{:id => "substance_select"}) %>
<% observe_field "substance_select",
:url => { :controller => 'materials',
:action=> 'view' }  %>

I know this don't passes any parameter but i wan't to get the method call work first.
Since i don't get any error message i don't have any clue where the problem is.
Thank you
robert

Last edited by comanda (2007-10-18 16:02:12)

Re: Drop down list and pass value

Hm ... don't see why the first one shouldn't work, but for the second variation, you pass the :id => to the options hash instead of the html_options, hash:

<%= collection_select('material','id', @materials, :id, :substance,{},{:id => "substance_select"}) %>
<% observe_field "substance_select",
                 :url => { :controller => 'materials', :action=> 'view' } %>

Are you sure there is nothing happening? What *should* happen? If it worked, would it send any RJS back?

Also, check that the HTML produced is correct ...