...

View Full Version : Image drag and drop problem



raindance
07-01-2012, 04:46 PM
Hi-
I am very new to PHP & Javascript and have a bug in this code which someone else did for me. It allows me to drag and drop images into order, but, if I do that, it seems to randomly de-select a bunch of them, which requires me to re-select them. Actually the way it is, I have to drag the images into order, click save, then in a second step, re-select them all and save the fact that I've re-selected them all for them to display live on my front end. But at some point in the history of this script, that was not the case. By default they were all selected, and I could just drag them into order and save the new order with one click. The problem now is if I drag them into order, it's de-selecting some.

Does anyone see an obvious reason for this? My current dev is not familiar with drag and drop.

Thanks in advance if there is anything obvious to tweak.

The complete code file is attached, it was too long to post here....

[CODE]


<!-- Script Code for sorting -->

* *<script type="text/javascript">
* ** $(document).ready(function(){
* ** ** $('#tablesorter').sortable({
* ** ** * *stop:function(e){
* ** ** ** *document.getElementById("sorted_data").value="";* ** ** ** *
* ** ** ** *var hValue = "";
* ** ** ** *$('#tablesorter li').each(function(el,p){
* ** ** ** ** *hValue = hValue + "," + $(p).find("input[type=hidden]").val();* ** ** ** ** *
* ** ** ** *});
* ** ** ** *document.getElementById("sorted_data").value = hValue;
* ** ** *}
* ** ** });
* ** });

* *
* *$(document).ready(function(){
* *
* ** *$('#tablesorter li').click(function() {* ** *
* ** ** *var p=this.parentNode.getElementsByTagName('li');* *
* ** ** *var str='';
* ** ** *document.getElementById("sorted_data").value="";
* ** ** *for(var i=0; i<p.length; i++)
* ** ** *{
* ** ** ** *for(var c=0; c<p[i].childNodes.length; c++)
* ** ** ** *{
* ** ** ** ** *if (p[i].childNodes[c].name != undefined && p[i].childNodes[c].name.substr(0, 6) == 'ord_id')
* ** ** ** ** *{
* ** ** ** ** ** *//str += 'image ' + i + ' -- ' + p[i].childNodes[c].name + ':' + p[i].childNodes[c].value + "\n";
* ** ** ** ** ** *break;
* ** ** ** ** *}
* ** ** ** *}
* ** ** * * *document.getElementById("sorted_data").value=document.getElementById("sorted_data").value+","+p[i].childNodes[c].value;
* ** * * *}
* ** ** *//alert(str);
* ** *
* ** *});
* *});


* </script>
* *

<!-- Script Code for sorting -->
[code]



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum