I would like to pass the value selected in a select statement back so
that I can use it in the controller, through using a remote_function
call, and I cannot figure out what I am doing wrong:
view rhtml:
<select id=“widgets_id” name=“widgets[id]” onchange="<%=
remote_function( :update => “parts”, :url=> { :action => :loadParts } )
%>">
<%= options_from_collection_for_select @widgets, ‘id’, ‘name’ %>
Select is built fine. I cannot find documented anywhere, where I can
pass back the current value of the select (ie, something like "id =>
…)
Any help greatly appreciated. TIA
Gerard <[email protected]…> writes:
I would like to pass the value selected in a select statement back so
that I can use it in the controller, through using a remote_function
call, and I cannot figure out what I am doing wrong:
[…]
Have a look at the remote_function() :with option.
Cheers,
Marco
On 4/22/06, Gerard [email protected] wrote:
Select is built fine. I cannot find documented anywhere, where I can
pass back the current value of the select (ie, something like "id =>
…)
This should do what you want. (I split up the remote_function thing to
make it easier to read in the email.)
<% func = remote_function(:update => “parts”, :url => {:action =>
:loadParts}, :with => “‘id=’ + escape(value)” -%>
<%= options_from_collection_for_select @widgets, 'id', 'name' %>