There is sortables capcha mod for phpbb based JQuery (http://
www.phpbb.com/community/viewtopic.php?t=1795925), example of working
mod you can look at http://topsecret.org.ua/ucp.php?mode=register. Is
it possible to convert this mod from JQuery to MooTools?
Look at JQuery code:
//no conflict jquery
jQuery.noConflict();
function createdata(listnameobject, column, resultid)
{
// Let's delete all the current input type="hidden" fields, this is
easier to find out which were changed
var data = document.getElementById(column);
if ( data.hasChildNodes() ) {
while ( data.childNodes.length >= 1 ) {
data.removeChild( data.firstChild );
}
}
// Run through all childs
jQuery.each( listnameobject, function(){
// We only want the ID of the answer
var answer = jQuery( this ).attr("id");
answer = answer.replace(/answer_/g, '');
// And add a hidden input field
inputbox = document.createElement("input");
inputbox.type = 'hidden';
inputbox.name = column + '[]';
inputbox.value = answer;
data.appendChild(inputbox);
});
}
jQuery(function() {
// Javascript nubs
document.getElementById('enable_js').style.display = 'block';
jQuery("#sortable1, #sortable2").sortable({
connectWith: '.connectedSortable',
items: 'li',
forcePlaceholderSize: true,
placeholder: 'bg3'
}).disableSelection();
jQuery("#sortable1, #sortable2").bind('sortreceive', function(event,
ui) {
// If the left or right column receive an item, put the child
nodes
in an array
var arrSortableListItemsLeft = jQuery( "#sortable1"
).children();
var arrSortableListItemsRight = jQuery( "#sortable2"
).children();
// And create hidden input fields
createdata(arrSortableListItemsLeft, 'sortables_options_left',
'#sortables_options_left');
createdata(arrSortableListItemsRight, 'sortables_options_right',
'#sortables_options_right');
});
})(jQuery);
I tried to convert this code, but I don't know how to send result of
sortables elements...
Here is beginning of Mootools code:
window.addEvent('domready', function(){
$$('#enable_js').setStyle('display', 'block');
var sb = new Sortables('#enable_js UL', {
clone: true,
revert: true,
opacity: 0.7,
/* initialization stuff here */
initialize: function() {
},
/* once an item is selected */
onStart: function(el) {
el.setStyle('background','#ddd');
},
/* when a drag is complete */
onComplete: function(el) {
el.setStyle('background','#fff');
//here must be send module
});
});
Any Ideas?