[code]
<?php echo $form->create('Permit',array('action' => 'add')); ?>
<?php echo $form->input('Activity',array('multiple' => 'checkbox',
'label' => 'Activity')); ?>
<?php echo $form->end('Save'); ?>
[/code]
and to ensure that the Activity field is filled with the possible
values and the chosen ones are checked, here is the small controller
code example:
[code]
$permits = $this->Permit->find(
'first', array(
'conditions' => array(
'Permit.id' => 1
),
'contain' => array(
'Leader' => array('Country','ProvState'),
'User',
'RegistrationLocation',
'Activity'
)
)
);
$this->data = $permits;
$this->set('activities',$this->Permit->Activity-
>find('list',array('contain' => false)));
[/code]
Hope this helps you on the way ;)
Enjoy,
John
On Feb 28, 10:37 am, "Arak Tai'Roth" <nielsen.dus...@gmail.com> wrote:
> Hey everyone, I did try looking around here and on google for this
> issue, however I can only find data that relates to problems 3 years
> ago, which doesn't help as much as I'd like it to. I could likely use
> it, but I figured that by now, Cake must have a more elegant way of
> doing this.
>
> I want to show the data that was selected in a HABTM in my edit form.
> I can see that the data is populated in $this->data when I do a
> read(), however it doesn't seem to be populating the multi-select box
> I have created.
>
> This is the code for the multi-select box:
> echo $form->input('Activity', array('label' => false, 'type' =>
> 'select', 'options' => $dbactivities, 'multiple' => true));
>
> Can anyone tell me how to display what items are selected?
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