You can also use onSuccess:function(){new Ajax.Updater(...)} to call
another update from inside the first Ajax.Updater call. Here's an
example where a checkbox is clicked to change an invoice status to
paid. Its then moved down to the paid table (id="invoices_done") and
then the onSuccess calls another update to change the total of all
outstanding invoices.

<?php echo
        '<input id="owed_check_' . $row['Invoice']['id']. '"
        type="checkbox"
        onclick="new Ajax.Updater
        (
                \'invoices_done\',
                \'/invoices/paid/' . $row['Invoice']['id']. '\',
                {
                        onSuccess:function()
                        {
                                new Ajax.Updater
                                (
                                        \'invoices_total\',
                                        \'/invoices/total\',
                                        {asynchronous:true, evalScripts:true}
                                );
                        },
                asynchronous:true, evalScripts:true
                });
                new Effect.Fade(\'owed_' . $row['Invoice']['id'] . '\');
        " />'
?>


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to