SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    sending drag and drop data to a php file

    im a complete idiot when it comes to javascript and i have no idea how to get the string that is created from this drag and drop script

    http://www.dhtmlgoodies.com/index.ht...rrange-nodes-2

    to a php file. theres some instructions on there to put it in a form but it might as well be chinese to me

    can someone help me out by getting this into a php file as a variable. id really apreciate it

    thanks

  2. #2
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anyone?

    this is the part that i dont get which im guessing does what im trying to do

    HTML Code:
    function saveData()
    	{
    		var saveString = "";
    		for(var no=0;no<dragableObjectArray.length;no++){
    			if(saveString.length>0)saveString = saveString + ';';
    			ref = dragableObjectArray[no];
    			saveString = saveString + ref['obj'].id;
    		}	
    		
    		alert(saveString);	// For demo only
    		
    		/* 	Put this item into a hidden form field and then submit the form 
    		
    		example:
    		
    		document.forms[0].itemOrder.value = saveString;
    		document.forms[0].submit;
    		
    		On the server explode the values by use of server side script. Then update your database with the new item order
    		
    		*/

  3. #3
    SitePoint Evangelist dmsuperman's Avatar
    Join Date
    Feb 2005
    Location
    A box
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What you'll do is set up a hidden form:
    Code:
    <form target="somepage.php" id="dragDropForm" style="display: hidden;"><input type="text" name="data" id="dragDropData"></form>
    Then have a button that calls the following function:

    Code:
    function saveDragDrop(){
      var saveString = "";
      for(var no=0;no<dragableObjectArray.length;no++){
        if(saveString.length>0)saveString = saveString + ';';
        ref = dragableObjectArray[no];
        saveString = saveString + ref['obj'].id;
      }
      document.getElementById("dragDropData").value = saveString;
      document.getElementById("dragDropForm").submit;
    }
    And then it will submit it to a somepage.php with $_GET["name"] being the string of data in the format: "elementone;elementtwo;elementthree;elementfour"
    <(^.^<) \(^.^\) (^.^) (/^.^)/ (>^.^)>
    Core 2 Duo E8400 clocked @ 3.375GHz, 2x2GB 800MHz DDR2 RAM
    5x SATA drives totalling 2.5TB, 7900GS KO, 6600GT

  4. #4
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so i replace the function saveData() with the function you gave me??

    thanks ill try it out

  5. #5
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    im really sorry but im still not getting this... heres what i got so far

    http://board-source.com/layout-tool.html

  6. #6
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bump


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •