ruby on rails - How to update my dropdown list without reloading the page -
i've got dropdown list user can select option. functionality works should page reloads each time. i've done bunch of reading , seen examples i'm having hard time synthesizing methods i've seen. know have pass ajax on format.js call in controller method like:
def update_device_position ... if @cabinet.add_cabinet_item(@position_str,params[:position].to_i) format.js
then in view, have add form_tag code this:
<div id="add_device"> <%= form_tag(:url => {:action => url_for(:controller => "cabinets", :action => :update_device_position), :position => , :id => @cabinet.id }, remote: true)%> <td> <%= select_tag :position_name, options_for_select(@selection_list) %> </td> <td> <%= hidden_field_tag 'position', %> <%= submit_tag "add" , :class => "btn" %> </td> </div>
when select new value cabinet slot , click submit, routing error stating no route matches [post] "/cabinets/99999999"
thanks.
Comments
Post a Comment