Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery Drag and Drop List problem
    primarykey
    data
    text
    <p>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.</p> <p>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:</p> <pre><code>&lt;ul class="sortable ui-sortable" id="sortable_buildings"&gt; &lt;li class="ui-state-default" id="1" style=""&gt;&lt;input type="hidden" name="order[]" value="128"&gt;&lt;span class="ui-icon ui-icon-arrowthick-2-n-s"&gt;&lt;/span&gt;Carlu&lt;/li&gt; &lt;li class="ui-state-default" id="1"&gt;&lt;input type="hidden" name="order[]" value="158"&gt;&lt;span class="ui-icon ui-icon-arrowthick-2-n-s"&gt;&lt;/span&gt;CPR Building&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>And the JQuery magic</p> <pre><code>$(document).ready(function(){ $("#sortable_buildings").sortable(); $('#selected_buildings').change(function(){ $('#sortable_buildings').html(''); var str = ""; $("#selected_buildings option:selected").each(function () { str += '&lt;li class="ui-state-default" id="1"&gt;&lt;input type="hidden" name="order[]" value="' + $(this).attr('value') + '" /&gt;&lt;span class="ui-icon ui-icon-arrowthick-2-n-s"&gt;&lt;/span&gt;' + $(this).text() + '&lt;/li&gt;' }); $("#sortable_buildings").append(str); }); }); </code></pre> <p>EDIT:</p> <p>Noticed this is a problem for all items created/modified in the form. How would I properly submit the form?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload