Greetings all.
I have a model that consists of Companies and their Contacts.
Both Contacts and Companies have one or more HABTM relationships.
Account HASMANY Contact
Account HABTM Service
Contact HABTM Interest
Now I have a form for a contact to edit their information, and they
can also change some Company info too, so the pertinent relationships
seem to be:
Contact BELONGSTO Account HABTM Services
Contact HABTM Interests
The Controller
My data is loaded by performing
$this->data = $this->Contact->find($id, array(), null, 5);
The big list of all interests and services come from
$interests = $this->Interest->find('list');
$services = $this->Account->Service->find('list');
$this->set(compact($interests, $services));
The View
The view consists of a bunch of fields, some simple text-boxes, and
some sets of checkboxes.
echo $form->create('Contact', array('action' => 'view'));
echo $form->input('id');
echo $form->input('Account.id');
echo $form->input('first_name');
echo $form->input('last_name');
echo $form->input('Company.description');
echo $form->submit('save');
echo $form->end();
That all seems to work fine.
When I get into the HABTM's though, I hit trouble. The contact-
interests are fine
echo $form->input('Contact.Interest', array('type'=>'select',
'multiple'=>'checkbox', 'options'=>array($interests),
'label'=>false));
But I cannot get the Company.Services working at all.
echo $form->input('Company.Service', array('type'=>'select',
'multiple'=>'checkbox', 'options'=>array($services), 'label'=>false));
or
echo $form->input('Contact.Company.Service', array('type'=>'select',
'multiple'=>'checkbox', 'options'=>array($services), 'label'=>false));
Hope that's enough info,
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---