adam291086 Posted June 30, 2008 Share Posted June 30, 2008 I am working on this project and need a little help. If you go to http://adamplowman.co.uk/Rubber_Duckie/moving.php you can move one of the boxes around and click on update, then if you go back to the page and refresh it, the changes are present. The problem is that i want to beable to move and change many items and up date all of them in the database, is there a way to do this??? I use php to get the objects style info from the database and then javascript to play with the objects. Any help is appreciated Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted June 30, 2008 Share Posted June 30, 2008 yeah, shouldnt be that hard, how are you recording the dragged div? seeing code would help Quote Link to comment Share on other sites More sharing options...
adam291086 Posted June 30, 2008 Author Share Posted June 30, 2008 the dragging is by javascript. which is here http://adamplowman.co.uk/Rubber_Duckie/moving.js Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted June 30, 2008 Share Posted June 30, 2008 you could create another hidden form element called div_name2 and use the following (you will have to record the div_name2 in the db as well): function update() { var divID=dobj.id.substring(3,4); if(divID=='1') { document.getElementById('div_name').value = dobj.id; } if(divID=='2') { document.getElementById('div_name2').value = dobj.id; } document.getElementById('height').value = dobj.style.height; document.getElementById('width').value = dobj.style.width; document.getElementById('top').value = dobj.style.top; document.getElementById('left').value = dobj.style.left; } Quote Link to comment Share on other sites More sharing options...
adam291086 Posted June 30, 2008 Author Share Posted June 30, 2008 yeah but problem being there is going to be a away to add in more object and i don't want to have loads of hidden forms. plus i want to be able to move around all objects and then click update and they all update not just the last one moved Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 30, 2008 Share Posted June 30, 2008 Use Ajax to send the new position every time it's moved? @_@ Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted June 30, 2008 Share Posted June 30, 2008 var divIDs= new Array; function update() { var divID=dobj.id.substring(3,4)-1; divIDs[divID]=[dobj.style.height,dobj.style.width,dobj.style.top,dobj.style.left]; } function formsubmit() { var infostring=divIDs.join('$$'); document.getElementById['info'].value=infostring; then enter the value of info into the database and break up the array into the correct variables when the page loads. Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted June 30, 2008 Share Posted June 30, 2008 ya darkwater prob has a better idea Quote Link to comment Share on other sites More sharing options...
adam291086 Posted June 30, 2008 Author Share Posted June 30, 2008 i don't get any of that can you explain a little Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.