# Drag and Drop with Scriptaculous

**URL:** <https://www.ruby-forum.com/t/drag-and-drop-with-scriptaculous/171517>\
**Category:** Rails\
**Created:** [July 3, 2009, 9:52pm UTC](https://www.ruby-forum.com/t/drag-and-drop-with-scriptaculous/171517 "2009-07-03T21:52:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mistressjanna](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@mistressjanna](https://www.ruby-forum.com/u/mistressjanna)\
**Post date:** [July 3, 2009, 9:52pm UTC](https://www.ruby-forum.com/t/drag-and-drop-with-scriptaculous/171517/1 "2009-07-03T21:52:01Z")

</div>

I have two side by side lists on a page, form\_\_list1 and form\_\_list2.  
I want to drag ffrom list 1 to list 2. I am terribly confused on what  
I must set up to make this drag and drop with Scritpaculous occur (and  
where — do I put things in my views, shown below, or the  
helpers…or the controller). I know how to get the values from  
form\_\_list2 in my controller…I just need to know what to put in  
(and where) to make the DnD via scriptaculus occur here. Thanks,  
Janna, view below:

 \<% form\_\_list1 = [] %\> \<% form\_\_list1selected = [] %\> \<% options\_for\_select\_hash = [] %\> \<% options\_for\_select\_hash = Associate.find(:all, :order =\> 'username ASC', :conditions =\> ["deleted=0 and (branch like ? or ? like branch)", @channel.defbranchcode, @channel.defbranchcode]).collect {|p| [p.username, p.id]} %\> \<%= select\_tag('form\_\_list1[]', options\_for\_select (options\_for\_select\_hash, form\_\_list1selected [options\_for\_select\_hash.length]), html\_options = {"size" =\> 15, "multiple" =\> true, :style =\> "width:200px"}) %\> 

 \<% form\_\_list2 = [] %\> \<% form\_\_list2selected = [] %\> \<%= select\_tag('form\_\_list2[]', options\_for\_select([], form\_\_list2selected[options\_for\_select\_hash.length+Associate.find (:all, :conditions =\> ["deleted=0"]).length]), html\_options = {"size" =\> 15, "multiple" =\> true, :style =\> "width:200px" }) %\>
