On Monday, March 1, 2010 12:42:02 AM UTC-3, Arak Tai'Roth wrote:
Nevermind, I got it figured out, thank you for your help.On Feb 28, 9:24 pm, "Arak Tai'Roth" <nielsen.dus...@gmail.com> wrote:
> I'm not sure I am following. I see where you are setting the data that
> you have, but I am not seeing where you are using that data in the
> view at all? Or do you not need to use it anywhere, cake just does?
>
> On Feb 28, 4:11 am, John Andersen <j.andersen...@gmail.com> wrote:
>
> > This is what I do, a small view example:
> > [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?
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
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
No comments:
Post a Comment