Debt Consolidation - Free Ecards - Credit Cards - Sport Betting Systems - Mortgagecalculators

PDA

View Full Version : scipt.aculo.us Drag & Drop and Fire Fox Question


cesarcesar
Apr 16th 2007, 11:55 am
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
<?php /* needed for IE */ ?>
<div id="page">
<div id="sale_row" class="section">
<div id="item_1" class="lineitem" style="cursor: move;">example 1 <input type="checkbox" name="check_value[]" value="example1"></div>
<div id="item_2" class="lineitem" style="cursor: move;">example 2 <input type="checkbox" name="check_value[]" value="example2"></div>
</div>
</div>

<?php /* set JS outside *page* div */ ?>
<script type="text/javascript">
// <![CDATA[
sections = ['sale_row'];

<?php /* this watches for event changes like drag and drop action */ ?>
Event.observe(window,'load',init,false);
function init() {

<?php /* add a sortable.create for each group level div */ ?>
Sortable.create('sale_row',{tag:'div', dropOnEmpty:true, containment:sections, only:'lineitem', onUpdate:updateData});
}

Sortable.create('page',{tag:'div',only:'section',handle:'handle'});
// ]]>
</script>


*Javasript* that formats and sends url to ajax db update page. When chekbox vars "params" are sent this works perfectly.
function updateData() {
var params = '';
var sections = document.getElementsByClassName('section');
sections.each(function(section) {
params = Sortable.serialize(section.id);
var ajax = new Ajax.Request(page_url,{
method: 'post',
parameters: params
});
});
}

krakjoe
Apr 17th 2007, 7:26 am
it's simply because gecko and IE have different methods for accessing the values of checkbox objects, use a different input type, like a normal hidden text input, or alternatively write something in to detect which browser you are being visited with and use the appropriate method.......

cesarcesar
Apr 17th 2007, 9:00 am
thanks for the advise. i do though, not understand, how to use a hidden input instead of a check box. How does the use select the hidden fields to send via POST?

krakjoe
Apr 17th 2007, 1:01 pm
can I see the code run ??

cesarcesar
Apr 17th 2007, 6:54 pm
sorry, the code is being used with confidential data.

Tonight i will be trying the method you suggested Krakjoe, using code from another's reply found here. http://www.webdeveloper.com/forum/showthread.php?p=742077#post742077

I will post my result if good when its finished.