I have a table with a collection select object that I am looking
update the selectedIndex of using links on the page
<%= collection_select(:machine, :user_id, @users, :id, :fullname,
{:include_blank => true}, html_options = {:onChange => remote_function
(:update => "ajaxmessage", :url => {:action => 'update_machine_user',
:controller =>
'manage_machines',:id=>@machine.id},:with=>"'users_id='+this.value")})
%>
Currently the links look like:
]<% if @machine.user_id != session[:user_id] %>
<%= link_to(image_tag('user_add.png'), {:action =>
'update_machine_user', :id => @machine, :users_id=>session[:user_id]},
{:border => 0, :title => "Edit Details", :class => "image_link"}) %>
<%else%>
<%= link_to(image_tag('user_reset.png'), {:action =>
'update_machine_user', :id => @machine, :users_id=>nil}, {:border =>
0, :title => "Edit Details", :class => "image_link"}) %>
<%end%>
Although they work they do a screen refresh of course since its not
Here is the controller used.
def update_machine_user
@machine = Machine.find(params[:id])
@machine.user_id = params[:users_id]
#flash.keep[:notice] = "User ID #{params[:user_id]}"
@machine.save
#flash[:notice] = 'User updated!!!'
redirect_to session[:last_list]
end
Can anyone give me some ideas of how to ajaxify this to update the DOM
element.
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---