I'm not doing anything fancy with habtm.
What i'm trying to do is have multiple checkboxes in cakephp, and, well, use them.
So i have this code in my view:
<div class="deleteButton">
<?php echo $form->input('', array('type'=>'checkbox',
'value'=>$video['Video']['id'], 'label'=>false, 'hiddenField'=>false,
'id'=>false, 'multiple'=>true)); ?>
</div>
and this gives me this html in the rendered page:
<input type="checkbox" value="30" name="data[Videos]">
<input type="checkbox" value="31" name="data[Videos]">
<input type="checkbox" value="32" name="data[Videos]">
Now, when i select this in the html and submit, i only get ONE value in the controller: ... pr($this->data); ...
Looks like cakephp is overwriting the values stored somehow, because the ONE value i get is always the last checked checkbox value.
What am i doing wrong?
UPDATE: Oh god i hate cakephp
Using this: http://nuts-and-bolts-of-cakephp.com/2008/05/05/multiple-checkboxes/
Or rather, this:: input($video['Video']['id'], array('type'=>'checkbox', 'value'=>$video['Video']['id'], 'label'=>false, 'hiddenField'=>false, 'multiple'=>true)); ?>
(i made $video['Video']['id'] the first entry, which is for ids, apparently)
My request is now black-holed by cakephp's completely ridic blackhole in the Security component. Honest, WHY doesn't the 404 page just have a toggleable error? Now i have to work out how to get a meaningful error from it...
any ideas are welcome!
UPDATE:SOLVED: Huh, instead I needed:
<?php echo $form->input("Video".$video['Video']['id']."id", array('type'=>'checkbox', 'value'=>$video['Video']['id'], 'label'=>false, 'hiddenField'=>false, 'multiple'=>true)); ?>
That is, i wrapped the $video['Video']['id'] with "Video" and "id".
NFI why this works, anyone have any ideas, i'll mark you as right!