On Jan 16, 12:22 am, brian <[email protected]> wrote:
> I think you could probably easily build the structure you want using
> Set in afterFind() (if not in the find itself). Can you post an
> example of the sort of array you would need if you were, say,
> displaying each option in an html table? Like if you did a straight
> find('all', $your_conditions).
Just to keep it simple, I've only got two fields in my 'find' until I
work out the logic. Once I have that worked out, I should be able to
open it up to however many fields I want.
$aliquots = $this->Aliquot->find(
'all',
array('fields' => array(
'Aliquot.id',
'Specimen.type'),
'conditions' =>
'Aliquot.box_id IS NULL', 'limit' => '0, 100',
'recursive' => 2
)
);
$this->set('aliquots', $aliquots);
Then in the view:
echo $form->input('Aliquot', array( 'label' => false,
'type'
=> 'select',
'multiple' => 'checkbox',
'options' => $aliquots));
The problem is that 'options' above doesn't seem to display a nested
array correctly. It's fine if I only define a single field in my find,
but since it uses the array for the labels as well as the value for
each checkbox, I can't define more information there to be displayed
only in the label. At least I haven't figured out how.
I could loop through and define each checkbox separately, but making a
multiple selection is difficult in that scenario unless I abandon the
form helpers altogether and just hand code the form.
> On Thu, Jan 15, 2009 at 5:02 PM, Tony Thomas <[email protected]> wrote:
>
> > I follow you up to this bit:
>
> >> <?php
>
> >> echo $form->input(
> >> 'Category',
> >> array(
> >> 'type'=>'select',
> >> 'multiple'=>'checkbox',
> >> 'options'=>$ids,
> >> 'label'=>false
> >> )
> >> );
> >> ?>
>
> > This doesn't seem to solve the problem of getting the other
> > information into my label. In fact, it's the exact method I'm using
> > now. I understand using $this->find('all', $options) and extract() to
> > separate the ids from the rest of the information, but how do I get
> > the other information displayed in my form? This method still leaves
> > me with checkboxes and ids, but no other info.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---