473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

script.aculo.us Drag & Drop and Fire Fox Question - dropping checkboxes

162 100+
Hello Fellow Developers,

I am using the awesome drag and drop script found at http://script.aculo.us/. I have also added a modification that interacts to a db for reordering upon release of a dragable item. Within each dragable is a input checkbox. This checkbox holds a DB id value that is sent on submit. This process works fine in IE, but in FF the checkbox values dont get sent via GET, or POST. How do i get FF to react as i think it should, and IE does. Heres a little bit of code from the project beyond the standard script.aculo.us library. Thanks,

Interface Script
Expand|Select|Wrap|Line Numbers
  1. <?php /*   needed for IE   */ ?>
  2. <div id="page">
  3.     <div id="sale_row" class="section">
  4.         <div id="item_1" class="lineitem" style="cursor: move;">example 1 <input type="checkbox" name="check_value[]" value="example1"></div>
  5.         <div id="item_2" class="lineitem" style="cursor: move;">example 2 <input type="checkbox" name="check_value[]" value="example2"></div>
  6.     </div>
  7. </div>
  8.  
  9. <?php /*   set JS outside *page* div   */ ?>
  10. <script type="text/javascript">
  11.     // <![CDATA[
  12.     sections = ['sale_row'];
  13.  
  14.     <?php /*   this watches for event changes like drag and drop action   */ ?>
  15.     Event.observe(window,'load',init,false);
  16.     function init() {
  17.  
  18.         <?php /*   add a sortable.create for each group level div   */ ?>
  19.         Sortable.create('sale_row',{tag:'div', dropOnEmpty:true, containment:sections, only:'lineitem', onUpdate:updateData});
  20.     }
  21.  
  22.     Sortable.create('page',{tag:'div',only:'section',handle:'handle'});
  23.     // ]]>
  24. </script>
  25.  
*Javasript* that formats and sends url to ajax db update page. When chekbox vars "params" are sent this works perfectly.
Expand|Select|Wrap|Line Numbers
  1. function updateData() {
  2.     var params = '';
  3.     var sections = document.getElementsByClassName('section');
  4.     sections.each(function(section) {
  5.         params = Sortable.serialize(section.id);
  6.         var ajax = new Ajax.Request(page_url,{
  7.             method: 'post',
  8.             parameters: params
  9.         });
  10.     });
  11. }
  12.  
Apr 16 '07 #1
5 2245
iam_clint
1,208 Expert 1GB
I'm not sure why firefox isn't taking this... I haven't seen any problems with checkboxes in forms on firefox before.
Apr 16 '07 #2
acoder
16,027 Expert Mod 8TB
Try giving the checkboxes ids and accessing them using getElementById.
Apr 17 '07 #3
empiresolutions
162 100+
I am using the drag and drop script found here, http://script.aculo.us/. Yes i know its a hog. Anyways, i am using the script pretty much out the box with link in the sortable div. My issue is that when clicking on a link, if you at all move the mouse, its sorts to the direction you ever so slightly moved. This is driving me nuts. I have tried to add pausing functions here and there trying to create a couple millisecond pause before dragging so the click can take effect, but i have had no luck.

Can anyone suggest a way to alter the script, so that if i click on the link in the div, it wont drag before the href is called. Thanks. Here's my example code.

Expand|Select|Wrap|Line Numbers
  1. <div id="page">
  2.  
  3.     <?php /*   div sits in a TD cell. div ID can be anything alphanumeric. HTML inside DIV is ok.  */ ?>
  4.     <div id="group" class="section">
  5.         <h3 class="handle">Group 1</h3>
  6.  
  7.         <?php /*   div ID can be anything alphanumeric, after *item_*. HTML inside DIV is ok.  */ ?>
  8.         <div id="item_1" class="lineitem"><a href="index.php">Item 1</a></div>
  9.         <div id="item_2" class="lineitem"><a href="index.php">Item 2</a></div>
  10.         <div id="item_3" class="lineitem"><a href="index.php">Item 3</a></div>
  11.         <div id="item_4" class="lineitem"><a href="index.php">Item 4</a></div>
  12.         <div id="item_5" class="lineitem"><a href="index.php">Item 5</a></div>
  13.     </div>
  14. </div>
  15.  
  16. <script type="text/javascript">
  17.     // <![CDATA[
  18.  
  19.     /*   add each ID from group level div.   */
  20.     sections = ['group'];
  21.  
  22.     /*   this watches for event changes like drag and drop action   */
  23.     Event.observe(window,'load',init,false);
  24.     function init() {
  25.  
  26.         /*   add a sortable.create for each group level div   */
  27.         Sortable.create('group',{tag:'div', dropOnEmpty: true, containment: sections, only:'lineitem'});
  28.     }
  29.  
  30.     /*   add sortable.create for *page* div   */
  31.     Sortable.create('page',{tag:'div',only:'section',handle:'handle'});
  32.     // ]]>
  33. </script>
  34.  
May 16 '07 #4
empiresolutions
162 100+
I am using the awesome drag and drop script found at http://script.aculo.us/. Its a hog, but has lots of features. I have also added a modification that interacts to a db for reordering upon release of a dragable item. Within each dragable is a input checkbox. This checkbox holds a DB id value that is sent on submit. This process works fine in IE, but in FF the checkbox values dont get sent via GET, or POST. How do i get FF to react as i think it should, as IE does.

Just to clarify, If a row is dragged, that row's checkbox will not be sent in the POST vars. It reacts as if not checked. I need all checked boxes to POST. I have has some help on this here, http://www.webdeveloper.com/forum/showthread.php?p=745951#post745951.
I think the quy has a good idea of the direction but its not correct.

Heres a little bit of code from the project beyond the standard script.aculo.us library. Thanks,

Interface Script
Expand|Select|Wrap|Line Numbers
  1. <?php /*   needed for IE   */ ?>
  2. <div id="page">
  3.     <div id="sale_row" class="section">
  4.         <div id="item_1" class="lineitem" style="cursor: move;">example 1 <input type="checkbox" name="check_value[]" value="example1"></div>
  5.         <div id="item_2" class="lineitem" style="cursor: move;">example 2 <input type="checkbox" name="check_value[]" value="example2"></div>
  6.     </div>
  7. </div>
  8.  
  9. <?php /*   set JS outside *page* div   */ ?>
  10. <script type="text/javascript">
  11.     // <![CDATA[
  12.     sections = ['sale_row'];
  13.  
  14.     <?php /*   this watches for event changes like drag and drop action   */ ?>
  15.     Event.observe(window,'load',init,false);
  16.     function init() {
  17.  
  18.         <?php /*   add a sortable.create for each group level div   */ ?>
  19.         Sortable.create('sale_row',{tag:'div', dropOnEmpty:true, containment:sections, only:'lineitem', onUpdate:updateData});
  20.     }
  21.  
  22.     Sortable.create('page',{tag:'div',only:'section',handle:'handle'});
  23.     // ]]>
  24. </script>
  25.  
*Javasript* that formats and sends url to ajax db update page. When chekbox vars "params" are sent this works perfectly.
Expand|Select|Wrap|Line Numbers
  1. function updateData() {
  2.     var params = '';
  3.     var sections = document.getElementsByClassName('section');
  4.     sections.each(function(section) {
  5.         params = Sortable.serialize(section.id);
  6.         var ajax = new Ajax.Request(page_url,{
  7.             method: 'post',
  8.             parameters: params
  9.         });
  10.     });
  11. }
  12.  
May 21 '07 #5
pbmods
5,821 Expert 4TB
Just a thought, but I'm thinking once you change the position of a checkbox, it is no longer considered a child of the parent form.

To test this, I would create a bunch of hidden inputs in the form and make those the values that get submitted. Then set up an onclick handler for each of the checkboxes that changes the value of its paired hidden input.
May 21 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Plumer | last post by:
Hello everyone, Yesterday I posted a message about implementing drag & drop in a TreeView control. I'm having real difficulty getting this to work -- the process seems to be incredibly...
1
by: Ed Sutton | last post by:
I am looking for a WinForms drag and drop example that shows how to implement dragging from a WinForm treeView and dropping on another application. I have drag & drop working from within the...
2
by: Barry Moon | last post by:
Hi Can anyone give me any help with passing an object across processes, via drag and drop? I've written a custom ListView control, which supports dragging and dropping of its items. The...
8
by: benkial | last post by:
I am writing a small GUI tool in C#, and I want to experiment some fancy trick as follows: when the user click on a "OK" button, the code will initiate a "Drag and Drop" operation in the GUI itself...
1
by: SteveDouglas | last post by:
Hi all, I am currently writing an application in VB.NET that has a lot of controls (treeviews/listviews/labels and so forth) that represent "things" that need to be draggable from place to place,...
0
by: Truevision .Net | last post by:
Hi, I have a problem with drag and drop functionality when it comes to dropping pictures from sources like for example internet explorer and the webbrowser control. Dragging and dropping from...
12
by: Daz | last post by:
Hi guys, I'm trying to make a script.aculo.us sortable list have a limited number of elements in it. Now I can check for this really easily and have a warning message, and of course the php...
1
by: Steve Bottoms | last post by:
Hi, all! Using VB .Net 2k5 under Vista Business... I'm trying to put together a very basic drag-and-drop for file copying, and can't seem to get DragDrop events (Form, PictureBox, TextBox, etc)...
1
by: patrickq | last post by:
What am trying to achieve is dragging an element from one IFRAME/FRAME into another IFRAME/FRAME. But upon dropping the element, I do not want the target IFRAME/FRAME to open/load it. I want to set...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.