Welcome Guest, Not a member yet? Register   Sign In
Drag and Drop Between Lists
#1

[eluser]bennyhill[/eluser]
I am trying to make a simple table reservation app. The user will see a list of guests (populated by a database query), and then another blank list representing the table. I want to make it so the user can drag and drop up to ten names into the second list, then click submit to enter it into the database.

The thing I am stuck on is not the PHP or CodeIgniter but the drag and drop part. Will I have to use a javascript library? What exactly happens when the name is dropped into the second list, is it adding the values to a javascript array? If so, how would I get that array from javascript to PHP and MySQL?

It doesn't have to be drag and drop. It can be a basic two list component with add remove buttons. Im just not that good in javascript.
#2

[eluser]got 2 doodle[/eluser]
This might help
mootools sortables demo
#3

[eluser]pixelazion[/eluser]
@bennyhill
you can try this link:
http://www.ikawka.com/2008/09/dagsort-wi...s/#content
you'll need prototype.js and scriptaculous for this one
#4

[eluser]Jay Turley[/eluser]
Well, just so it doesn't feel left out, I feel compelled to mention jQuery and it's own brand of draggy-droppyness: the jQuery ui drag and drop modules. You'll have to download the core and Draggable modules.
#5

[eluser]xwero[/eluser]
jQuery UI sortable demo and documentation

Your code will look like this
Code:
$("#myList").sortable({
   change: function(){
              $.ajax({
                      type: "POST",
                      url: "some.php",
                      data: $('#myList').sortable('serialize'),
                      success: function(msg){
                                 alert( "Data Saved: " + msg );
                      }
                     });
           }
});

Edit : Jay beat me Smile
#6

[eluser]got 2 doodle[/eluser]
I'm trying to learn some javascript and specifically the mootools library

There is are some fantastic tutorials here

This one is about sortables mootools sortables tutorial

This one is on drag and drop mootools drag and drop




Theme © iAndrew 2016 - Forum software by © MyBB