Got it all working, thanks for your help. This is what I needed 'Record.'.$i.'.delete'
On Sep 9, 8:02 pm, Jas <[email protected]> wrote: > OK, trying to get the array layout like yours. I've only been able to > get this close. > > Array > ( > [Records] => Array > ( > [id] => 17 > [delete] => 0 > ) > > ) > > echo $form->hidden('Records.id]',array('value' => $record['Record'] > ['id'])); > echo $form->checkbox('Records.delete]',array('value' => $record > ['Record']['delete'])); > > How would I get id and delete into an array itself, as you see it only > stores the last checkbox information and not all > > On Sep 9, 6:12 pm, WebbedIT <[email protected]> wrote: > > > I would be creating a new action in your controller to handle your > > multiple soft delete and you would need to pass a data array > > structured as follows: > > > Array > > ( > > [ModelName] => Array( > > [0] => Array > > ( > > [id] => 1 > > [deleted] => 0 > > ) > > [1] => Array > > ( > > [id] => 2 > > [deleted] => 1 > > ) > > ) > > [2] => Array > > ( > > [id] => 3 > > [deleted] => 0 > > ) > > ) > > ) > > > In your controller action you can then call something like: > > > $this->ModelName->saveAll($data['ModelName']); > > $this->redirect('index'); > > > Which in the above data array example would set record 2's delete > > field to true and then you are passed back to the index which will now > > not show record 2 if your pagination conditions are set to ignore > > records with a delete value of 1. > > > The only Cake-y part about this is the format of the data array so you > > can use the saveAll() call, the rest of it is standard PHP coding > > really, although you can use cake's helpers to make that process > > easier to, but you're still just wrapping your index in a form with a > > hidden field for each records id and a checkbox for their delete > > value. > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---
