Me going at it from completely the wrong direction from the start
makes it make so much more sense.  Thank you!

On Mar 17, 4:18 pm, cricket <zijn.digi...@gmail.com> wrote:
> Grab a list of the types in the CompaniesController:
>
> $this->set('types', $this->Company->CompanyType->find('list'));
>
> That produces an array with the PK as key and the name as value. If
> your table column is not 'name' you should specify it in the
> CompanyType model:
>
> var $displayField = 'your_column_name';
>
> echo $form->input(
>         'CompanyType',
>         array(
>                 'type' => 'select',
>                 'multiple' => 'checkbox',
>                 'label' => 'whatever'
>         ),
>         $types
> );
>
> On Mar 17, 5:02 pm, Gillian <gillian....@gmail.com> wrote:
>
> > I'm pretty new to Cakephp, so this could be rather simple and I'm just
> > missing it.
>
> > I'm attempting to set up a form that deals with a lot of tables and
> > models.  At the moment, I've set up the company model so that is
> > hasmany company types, and the company_types table so it belongsto
> > company.  And in the view I set it up as:
>
> > echo $form->input('CompanyType.0.type', array(
> >                         'type' => 'select',
> >                         'multiple' => 'checkbox',
> >                         'options' => array(
> >                                 'Paving' => 'Paving',
> >                                 'Rock Crushing And Screening' => 'Rock 
> > Crushing And Screening',
> >                                 'Sweeping' => 'Sweeping',
> >                                 'Grinding' => 'Grinding',
> >                                 'Cranes' => 'Cranes'
> >                         ));
>
> > Obviously, this alone isn't enough because I'm getting the error: SQL
> > Error: 1054: Unknown column 'Array' in 'field list' [CORE\cake\libs
> > \model\datasources\dbo_source.php, line 527]
>
> > What I'd prefer to do is explode the array in such a way so as to have
> > each option selected be separately entered into the company_type table
> > linked to the current company_id, rather than imploding it into a
> > single string.  Can anyone give me any pointers?

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to