I have a table structure like this
admins table habtm rights table belongs to rights_groups
In view I need to print like this as checkbox
Rights_group Name1
Rights1
Rights2
Rights_group Name2
Rights3
Rights4
View code (Since I have to give the group name, I need to loop through
the records)
$checked = $form->value('Right.Right');
foreach ($rights as $id => $item) {
// Here Im printing the group name with some condition
echo $form->input("Right.checked." . $item['Right']['id'],
array(
'label'=> $item['Right']['name'],
'type'=>'checkbox',
'checked'=>(isset($checked[$item
['Right']['id']])?'checked':false),
));
}
All these are working fine, but it is not saving the records in the
join table. If I give in the following way, it is working (but I need
to show the group name in between)...
echo $form->input('right', array('div' => false, 'label' => false,
'class' => 'otherforms', 'type' => 'select', 'multiple' =>
'checkbox'));
Any help ?
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment