Results 1 to 6 of 6

Thread: Saving Drag and Drop position

  1. #1
    Join Date
    Nov 2006
    Location
    CA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Saving Drag and Drop position

    does anyone know where I can find a script or tutorial that explains how to save the final position of an item that was moved using the drag and drop script?

    We are using php and MySql . I am not a coder so if you don't need that info, sorry.

    thanks so much!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well, if it is a script, a javascript cookie would be fine in many cases. It really depends upon how bullet proof and secure you want this information to be and, how persistent. Also, if your user's need to log on, you might want to save the data in their profile so that it would be available to them from any computer.

    Your main choices would be:

    1. A javascript cookie, insecure and subject to user deletion but, adequate in non-mission critical settings. Uses no server resources.
    2. A server side cookie, as secure and permanent as your server is capable of making it.
    3. A part of the users account on your site - assuming that is set up securely, this would be very secure and permanent.


    Wow, sounds like I know a lot. But, I really know just enough to tell you that much. Unless you want to go the javascript cookie route, the least secure and permanent way. I know almost all about how to do that. A good tutorial on javascript cookies is here:

    http://www.quirksmode.org/js/cookies.html

    And, depending upon the exact drag and drop script you are using, you will either need to find a way get the final position from the script or, it may already have a built in way to deliver that information.

    If you want to use javascript cookies, you need to decide how long to save the information but, it will only continue to be available to the user if they continue using the same computer - even the same account on that computer, and don't delete the cookie - as, javascript cookies are stored in the user's account on the user's computer.

    If all that is OK with you and you want to use a javascript cookie, and you need more help, let me know the exact drag and drop script you are using. A link to your page that uses the script would be good too.

    If you want to go server side with this, someone else may help you out here or, you could ask in the PHP or MySql forum.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Nov 2006
    Location
    CA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    wow.. great answer. thanks so much.
    yes we are going with saving on the server side using php and mysql and staying away from using cookies.
    I don't know which code our programmer is using, just know he was having trouble figuring out how to determine the final location and save it to the user's profile account.
    thanks so much again... maybe someone who is familiar with php can give me some insights as to what the programmer needs to do?

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Determining the final position is information that the script has available in one form or another. Many drag and drop scripts have special return functions to make this info easy to get, others require a bit of sleuthing to see how to get this info from the existing code. I could help with that if I had the script you are using.

    Then a PHP person would need to use some method of converting that to a value that could be saved and retrieved. Not being a PHP person, hidden form data is the one that springs to my mind. Form data can be both read and written by both PHP and javascript. The actual points in time during page load and unload at which PHP and javascript can do these things would need to be coordinated. I think with PHP, you would need to have the page submit or at least post to save the data. Retrieving it would simply be a matter of PHP writing to the page as it is served and having javascript read that information as it loads or onload.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Nov 2006
    Location
    CA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks so much.. not being a coder myself this all sounds very complicated. I am going to discuss it with our guy and see where to go from here. I will see if I can get him to join this great forum and perhaps pickup this thread. thanks everyone.

  6. #6
    Join Date
    May 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello

    Nice example, I need this example to save the settings of a page. I am using this example and need to save the settings...

    http://aymanh.com/drag-drop-portal-i...2#comment-8840

    the source code is attached on this site...

    Any help would be great...

    Thanks
    -P

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
  •