I can't get a sortable list to work with cake. Funny thing is that I
can get it to work without Cake, and the problem I'm seeing should
break everybody who tries, yet I'm seeing messages from folks who are
able to do it.
Here's what my view outputs:
<ul id="task_list_3" class="sortable-list">
<li id="task_72"><input id="todo_check_72" type="checkbox" onClick="new
Ajax.Updater('tasks_done_3','/perwikidev/task_lists/done/72',
{asynchronous:true, evalScripts:true, requestHeaders:['X-Update',
'tasks_done_3']});new Effect.Fade('task_72');" /> <span
class="handle">first item</span></li>
<li id="task_73"><input id="todo_check_73" type="checkbox" onClick="new
Ajax.Updater('tasks_done_3','/perwikidev/task_lists/done/73',
{asynchronous:true, evalScripts:true, requestHeaders:['X-Update',
'tasks_done_3']});new Effect.Fade('task_73');" /> <span
class="handle">second item</span></li>
<li id="task_74"><input id="todo_check_74" type="checkbox" onClick="new
Ajax.Updater('tasks_done_3','/perwikidev/task_lists/done/74',
{asynchronous:true, evalScripts:true, requestHeaders:['X-Update',
'tasks_done_3']});new Effect.Fade('task_74');" /> <span
class="handle">third item</span></li>
</ul>
<script type="text/javascript">
function updateOrder() {
var options = {
method : 'post',
parameters : Sortable.serialize('task_list_3')
//parameters : "crud1=56&crud2=49&crud3=67"
};
//alert(Sortable.serialize('task_list_3'));
new Ajax.Request('/perwikidev/task_lists/reorder/3', options);
}
function taskCompleted(task) {
var options = { task: task };
new Ajax.Request('/todo/taskcomplete.php', options);
}
Sortable.create('task_list_3', { handle:'handle',
onUpdate:updateOrder });
</script>
</div>
Now, if I uncomment that alert in the javascript, I can see the output
from Scriptaculous looks reasonable, something like this:
task_list_3[]=74&task_list_3[]=73&task_list_3[]=72
In fact, when I send that output to a non-cake php app, I can pull
those parameters from $_POST, it looks like this:
Array
(
[task_list_3] => Array
(
[0] => 74
[1] => 73
[2] => 72
)
[_] =>
)
However, with that identical html, javascript and javascript return
values in cake, I get this in $_POST (and $this->params['form']):
Array
(
[task_list_3] => Array
(
[0] => 72
)
[_] =>
)
It's like cake isn't handling multiple keys with the same name
correctly. But as I say, I see others have done this successfully with
cake, so I'm confused. I've tried cake 1.1.8 and upgraded to the latest
1.1.11 to be sure this wasn't something that was fixed.
Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---