Add onchange or onclick to field in select

Hello
I’d like to make a list of items and then when an item is clicked, I
display the “edit” view, something like
@items = Item.find(:all)
<%= select ‘my_items’, select_options(@items), :onchange =>
remote_function(edit_item_path(item)) %>
How can I pass only the clicked Item to the edit view :
edit_item_path(item)

thanks

I’m using the following:

:onChange => remote_function(:url => {:action =>
‘choose_stylist’}, :with => “‘stylist=’ + value”)

You might be able to do this:

:onChange => remote_function(edit_item_path, :with => “‘item=’ +
value”)

You might need to set up ‘edit_item’ in your controller to use
params[:item] in this case - I’m not sure. I think that the ‘:with =>
stuff’ is what you need, though.

-Kyle

On Mar 26, 5:43 am, “Abir B.” [email protected]

Kyle wrote:

I’m using the following:

:onChange => remote_function(:url => {:action =>
‘choose_stylist’}, :with => “‘stylist=’ + value”)

You might be able to do this:

:onChange => remote_function(edit_item_path, :with => “‘item=’ +
value”)

You might need to set up ‘edit_item’ in your controller to use
params[:item] in this case - I’m not sure. I think that the ‘:with =>
stuff’ is what you need, though.

-Kyle

On Mar 26, 5:43 am, “Abir B.” [email protected]

The problem is that edit_item_path require an id, and must be written
edit_item_path(id) so can someone tell me how change the route
edit_item_path so that It does’nt require this param??
thanks

I wonder if it might be as simple as this:

:onChange => remote_function(edit_item_path(value))

?

-Kyle

On Mar 27, 3:52 am, “Abir B.” [email protected]