Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5955507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:07:27+00:00 2026-05-22T18:07:27+00:00

I have created a drag and droppable list on my website, and the drag/drop

  • 0

I have created a drag and droppable list on my website, and the drag/drop aspect of it seems to be working. Inside of each list element is a “hidden” form field which contains data assioated with each list element.

Now if I dont drag the list at all, and submit the form, everything submits as expected. However, if I dragged an element over another, the element I dragged(or any element whose DOM got shifted around) does not get submitted. Not really sure whats going on here. Here is a snippet of each draggable element:

<ul class="sortable ui-sortable" id="sortable_buildings">
<li class="ui-state-default" id="1" style=""><input type="hidden" name="order[]" value="128"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Carlu</li>

<li class="ui-state-default" id="1"><input type="hidden" name="order[]" value="158"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>CPR Building</li>
</ul>

And the JQuery magic

$(document).ready(function(){
            $("#sortable_buildings").sortable();

            $('#selected_buildings').change(function(){
                $('#sortable_buildings').html('');
                var str = "";
                $("#selected_buildings option:selected").each(function () {
                   str +=  '<li class="ui-state-default" id="1"><input type="hidden" name="order[]" value="' + $(this).attr('value') + '" /><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>' + $(this).text() + '</li>'
                 });
                 $("#sortable_buildings").append(str);
            });
        });

EDIT:

Noticed this is a problem for all items created/modified in the form. How would I properly submit the form?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:07:28+00:00Added an answer on May 22, 2026 at 6:07 pm

    Inside <form> tag when you submit, every hidden element should be serialized and submitted. For this, I think when you are dragging an element it is going beyond the <form> tag hence not submitted


    Addition: You need not to create an hidden element to store the value of the <li> element. You should follow this approach:

    1. .data method to store data for any <li> element
    2. assign a custom event handler for the form.

    In this case, point (1) of your code will be:

    /* store and append <li> tag */

    var tempList=$("<li>other stuff but no hidden field</li>");
    tempList.data("value", $(this).attr("value"); // store 128/158 whatever you want
    $(target).append(tempList);
    
    // bind form submit option
    $(this).parent().bind("submit", function() 
    { 
    // serialize all <li> tag with data :-)
    }
    

    /* retrieve */

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a jqueryUI drag drop list. Now, i need to remove an
I have created a nested list with drag/drop functionality. My issue is that I
I have a UITextview in my Screen,I created textview in drag and drop on
I have created a listview. and there I also did the drag n drop
i have created the drag and drop work. Here i can place the drag
I have created a ListView which contains a list of items. Each item in
BACKGROUND: I have a draggable that I drop inside a droppable cum draggable. On
I've just started learning javascript and have created a drag and drop using jquery
I have created a table using mootools sortables to implement drag and drop functionality.
I have a horizontal jquery-ui drag drop list contained in a wrapper in which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.