Forum: Ruby on Rails Sortable list with non ajax submission

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Matthew M. (Guest)
on 2006-06-10 02:33
(Received via mailing list)
I am trying to create a sortable list that is submitted not with an AJAX
call but by a standard form submit button.
Right now I have

def reorder_group_members
    @group = Group.find(params[:id])
    @group.group_members.each do |member|
      member.position = params[:memberlist].index( + 1
#I get a nil error for this line.  It would seem that
params[:memberlist] is not getting set.
    render :action => 'index'

with view

<%=start_form_tag  :action=>'reorder_group_members', :id => @group%>
  <ul class="group_members" id="memberlist"
  <% for member in @group.group_members-%>
    <li id="memberlist_<>"><></li>
<%= sortable_element 'memberlist' -%>

This works fine in terms of the member list being sortable by dragging
but when I click the submit button I get a nil error because the sorting
information is not being passed as a paramater.  Any ideas?

Thank you,
Matthew M.
This topic is locked and can not be replied to.