I can show you how I do this in PHP, not Perl but a cousin.
$v){
if($product = ActiveRecord::FindById('products',$v)) {
$product->position = $k+1;
$product->save();
}
}
print 'finished';
?>
This relies on the following HTML:
Product 1
...etc... (each product ID'd according to the rules for sortable)
And JavaScript:
Sortable.create('sort_list',{
onUpdate: function(){
new Ajax.Request('ajax_update_position.php',{
parameters: Sortable.serialize('sort_list'),
evalScripts:true,
onCreate: function(transport){
$('message').show().update('');
},
onComplete: function(transport){
$('message').update('Changes saved!');
new Effect.Highlight('message');
new Effect.Fade('message',{delay:1});
}
})
}
});
This is a really old example, I would probably write this all much more cleanly
now (and I'd be doing it in Rails anyway) but this works very solidly.
Walter
On Mar 10, 2012, at 1:52 PM, Dave wrote:
> Hi,
> I began experimenting with the 'sortables' and really like the 4th
> version. I'm extracting the list from a MySql db to build the list and
> all works fine but how do I get the results back into the database
> after the sort? I'm using perl--need this for a cgi script. Thanx.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to prototype-scriptaculous@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.