Forum: Ruby on Rails drag and drop sorting not working at all?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Taylor S. (Guest)
on 2009-01-17 00:15
Silly though it may be, I can't get a list to be draggable.  I haven't
set up the update partials but I can't even get the elements to become
draggable. Here is what my HTML output is:

<head>
  <script src="/javascripts/dragdrop.js?1230671275"
type="text/javascript"></script>
</head>

  <div id='Q2_answers'>
    <ul id='Q2_answer_list' class='answer_list'>
       <li id='item_3' class='answer_list_item'>John</li>
       <li id='item_2' class='answer_list_item'>Edward</li>
       <li id='item_1' class='answer_list_item'>Bill</li>
    </ul>
</div>

<script type="text/javascript">
//<![CDATA[
Sortable.create("Q2_answer_list", {onUpdate:function(){new
Ajax.Updater('Q2_answers', '/surveys/1', {asynchronous:true,
evalScripts:true, onComplete:function(request){new
Effect.Highlight("Q2_answer_list",{});},
parameters:Sortable.serialize("Q2_answer_list") + '&authenticity_token='
+ encodeURIComponent('de77455cc1af8b8c3e33f2faf5f3a391a1f4e1cb')})}})
//]]>
</script>

The ERB for this is:
<%= sortable_element "Q#{question.position}_answer_list",
  :update => "Q#{question.position}_answers",
  :complete => visual_effect(:highlight,
"Q#{question.position}_answer_list") %>


Why won't these elements drag???  Thanks in advance.
Taylor S. (Guest)
on 2009-01-17 00:34
Taylor S. wrote:
> Silly though it may be, I can't get a list to be draggable.  I haven't
> set up the update partials but I can't even get the elements to become
> draggable. Here is what my HTML output is:
>
> <head>
>   <script src="/javascripts/dragdrop.js?1230671275"
> type="text/javascript"></script>

Apparently drag and drop doesn't work with just dragdrop.js as specified
in an older rails tutorial.  You need the full prototype library. Using
javascript_include_tag :defaults fixed this issue.
This topic is locked and can not be replied to.