Hi All,

I've been working on a little bit of code that allows me to drag &
drop using script.aculo.us, Draggable and Droppable.  I am able to
successfully drag and drop a div, however, the last thing I am trying
to do is update the database with the change.  I am currently using
PHP and pulling the location of the div from a MySQL database.

Here's my javascript in the <HEAD>:

    <script type="text/javascript">
   window.onload = function() {
   Droppables.add(
     '4',
     {
        hoverclass: 'hoverActive',
        onDrop: moveItem
     }
  );
   // Set drop area by default  non cleared.
   $('droparea').cleared = false;
}
function moveItem( draggable,droparea){
   if (!droparea.cleared) {
      droparea.innerHTML = '';
      droparea.cleared = true;
   }
   draggable.parentNode.removeChild(draggable);
   droparea.appendChild(draggable);
   moveEvent(droparea,draggable);
}

function moveEvent(droparea,draggable)
{
           var ajaxIndex = ajaxObjects.length;
       ajaxObjects[ajaxIndex] = new sack();
       ajaxObjects[ajaxIndex].requestFile = 'moveEvent.php?id=' +
draggable + '&day=' + droparea;
       ajaxObjects[ajaxIndex].onCompletion = function(){ reloadCalendar
(); };  // Specify function that will be executed after file has been
found
       ajaxObjects[ajaxIndex].runAJAX();
}
</script>


Here's the HTML/PHP for the "draggable" area:

<div id="event'.$event['id'].'" class="draggable"><div id=\'header'.
$event['id'].'\' style="background-color:#'.$event_type['color'].';"
onmouseover=\'this.style.cursor="move"; new Draggable(event'.$event
['id'].', { revert:true, handle: "header'.$event['id'].'" });\'>'.
$event['name'].'</div></div>


Here's the HTML/PHP for the "droppable" area:

<div id="day4" class="day"></div><div id="4" class="droppable"> <div
id=events>'.$day[3].'</div></div></div>

Like I said, I can drag and drop just fine.  Just, for some reason, it
is not updating the database.  Any ideas?  Is there something wrong in
my Javascript?

I know the PHP file "moveEvent.php" works, because I've tested it.

Many thanks!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to