Topic: Scriptaculous Drag and Drop (complicated)

Here's what I am trying to do.  A unit is like a group of tasks that occur within a date range (startdate & enddate).  Right now I have it rendering my unassigned tasks in a div and then a div for each date between the start and enddate for the unit.  That way the tasks can be dragged from day to day without issue.  The way I have it set up now it properly displays the list, and I can drag the tasks into the day div; but when I refresh it doesn't save the date the task was drug to.  Because I'm dealing with raw JS rather than helpers I'm completely lost on how to write the date to the task when it is dropped.

Thanks

<script language="JavaScript">
    sections = ['unassigned', <% for day in @days %><% domid = "day_#{day.id}" %>'<%= domid %>',<% end %>];

    function createNewSection(name) {
        var name = $F('sectionName');
        if (name != '') {
            var newDiv = Builder.node('div', {id: 'group' + (sections.length + 1), className: 'section', style: 'display:none;' }, [
                Builder.node('h3', {className: 'handle'}, name)
            ]);

            sections.push(newDiv.id);
            $('page').appendChild(newDiv);
            Effect.Appear(newDiv.id);
            destroyLineItemSortables();
            createLineItemSortables();
            createGroupSortable();
        }
    }

    function createLineItemSortables() {
        for(var i = 0; i < sections.length; i++) {
            Sortable.create(sections[i],{tag:'div',dropOnEmpty: true, containment: sections,only:'lineitem'});
        }
    }

    function destroyLineItemSortables() {
        for(var i = 0; i < sections.length; i++) {
            Sortable.destroy(sections[i]);
        }
    }

    function createGroupSortable() {
        Sortable.create('page',{tag:'div',only:'section',handle:'handle'});
    }

    /*
    Debug Functions for checking the group and item order
    */
    function getGroupOrder() {
        var sections = document.getElementsByClassName('section');
        var alerttext = '';
        sections.each(function(section) {
            var sectionID = section.id;
            var order = Sortable.serialize(sectionID);
            alerttext += sectionID + ': ' + Sortable.sequence(section) + '\n';
        });
        alert(alerttext);
        return false;
    }
    </script>
<h1><%= @unit.name %></h1>
    <% unless @unit.name.blank? %><p><b>Name:</b> <%= @unit.name %></p><% end %>
    <% unless @unit.address1.blank? %><p><b>Address 1:</b> <%= @unit.address1 %></p><% end %>
    <% unless @unit.address2.blank? %><p><b>Address 2:</b> <%= @unit.address2 %></p><% end %>
    <% unless @unit.city.blank? %><p><b>City:</b> <%= @unit.city %></p><% end %>
    <% unless @unit.state.blank? %><p><b>State:</b> <%= @unit.state %></p><% end %>
    <% unless @unit.zipcode.blank? %><p><b>Zip Code:</b> <%= @unit.zipcode %></p><% end %>
    <p><b>Start Date:</b> <%= @unit.startdate %></p>
    <p><b>End Date:</b> <%= @unit.enddate %></p>
    <p><b>Actual End Date:</b> <%= @unit.actualenddate %></p>
    <p><b>Status:</b> <%= @unit.status %></p>
    <p><b>Priority:</b> <%= @unit.priority %></p>
    <p><b>Active:</b> <%= @unit.active %></p>


<div id="page">
    <h4><b>Un-Assigned Tasks</b></h4>
    <div id="unassigned" class="section">
    <%= render :partial => "unassigned_tasks" %>
    </div>

    <% for day in @days %>
        <% domid = "day_#{day.id}" %>
        <div id='<%= domid %>' class="section">
            <h3 class="handle"><%= day.date %></h3>
            <% day.tasks.each do |task| %> 
                <% romid = "item_#{task.id}" %>
                <div id='<%= romid %>' class="lineitem"><%= task.name %> <%= task.duration %> hrs.</div>
            <% end %>
        </div>
        <script type="text/javascript">
    // <![CDATA[
    Sortable.create('<%= domid %>',{tag:'div',dropOnEmpty: true, onUpdate:function(){new Ajax.Request('/units/sort_todos', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("priority_todos")})}, containment: sections,only:'lineitem'});
    // ]]>
</script>
    <% end %>

</div>

<script type="text/javascript">
    // <![CDATA[
    Sortable.create('unassigned',{tag:'div',dropOnEmpty: true, containment: sections,only:'lineitem'});
    // ]]>
</script>

<%= link_to 'Edit', :action => 'edit', :id => @unit %> |
<%= link_to 'Back', :action => 'list' %>


FYI the unassigned partial renders all tasks with null days