Friday, November 28, 2008

Re: accessing different models in controller

I meant to do list rather than find all since you need a list but the
default in the options, I assume this is a select box, and thus you
can set a variable and then just set the default in the options array
and set it to that variable or you can set $this->data for the poll_id
to whatever the default is and it should set it.

On Nov 28, 12:08 am, AngeloZanetti <angelo...@gmail.com> wrote:
> thatsgreat2345 wrote:
>
> > I assume there is a relation between polls and featured_poll? If so
> > you should be able to get them by possibly increasing your recursive
> > to 2 I believe. That or $this->Club->Poll->FeaturedPoll->find('all')
>
> Thanks thatsgreat2345 the $this->Club->Poll->FeaturedPoll->find('all')
> worked, I couldn't set recursion level to 2 as it was way too slow.
>
> Ok so now I got the FeaturedPollID, I would like to know how to set the
> detault POLL radio button to that featured poll ID.
>
> In the controller I have:
>
>         $allpolls = $this->Club->Poll->find('all', array('conditions' =>
> array('active' => 1), 'fields' => array('id', 'question'), 'order' =>
> 'question asc'));
>
> which gets all the poll options. In the view I see you normally set the
> field values as follows:
>
>         echo $form->input('poll_id', array('label' => 'Poll: '));
>
> I assume this sets the default value from the DB works obviously with edit
> obviously as the value is set in the DB, but how do I set that featured POLL
> ID to that variable?
>
> Thanks again.
>
> --
> View this message in context:http://www.nabble.com/accessing-different-models-in-controller-tp2072...
> Sent from the CakePHP mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
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: