Re: Label information for Multiple Checkboxes

2009-01-20 Thread Tony Thomas

That worked! Thanks!

On Jan 20, 8:54 am, grigri  wrote:
> // controller
> $aliquots = $this->Aliquot->find('all', array(
>   'conditions' => whatever,
>   'fields' => array(
>     'Aliquot.id',
>     'Aliquot.additive',
>     'Specimen.type',
>     'Specimen.draw_date'
>   ),
>   'recursive' => 0
> ));
> $this->set('aliquots', Set::combine($aliquots,
>   '{n}.Aliquot.id',
>   array(
>     '{0} [{1} / {2}]', // Format
>     '{n}.Aliquot.additive', // Field #0
>     '{n}.Specimen.type', // Field #1
>     '{n}.Specimen.draw_date' // Field #2
>   )
> ));
> // view
> echo $form->input('Aliquot', array('options' => 'aliquots', 'multiple'
> => 'checkbox'));
>
> Alternatively, if you want the checkboxes grouped - say by specimen
> type, then use this:
>
> $this->set('aliquots', Set::combine($aliquots,
>   '{n}.Aliquot.id',
>   array(
>     '{0} [{1} / {2}]', // Format
>     '{n}.Aliquot.additive', // Field #0
>     '{n}.Specimen.type', // Field #1
>     '{n}.Specimen.draw_date' // Field #2
>   ),
>   '{n}.Specimen.type'
> ));
> // view
> echo $form->input('Aliquot', array('options' => 'aliquots', 'multiple'
> => 'checkbox'));
>
> hth
> grigri
>
> On Jan 20, 2:32 pm, Tony Thomas  wrote:
>
> > On Jan 16, 12:22 am, brian  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  wrote:
>
> > > > I follow you up to this bit:
>
> > > >> 
> > > >> 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 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
-~--~~~~--~~--~--~---



Re: Label information for Multiple Checkboxes

2009-01-20 Thread grigri

// controller
$aliquots = $this->Aliquot->find('all', array(
  'conditions' => whatever,
  'fields' => array(
'Aliquot.id',
'Aliquot.additive',
'Specimen.type',
'Specimen.draw_date'
  ),
  'recursive' => 0
));
$this->set('aliquots', Set::combine($aliquots,
  '{n}.Aliquot.id',
  array(
'{0} [{1} / {2}]', // Format
'{n}.Aliquot.additive', // Field #0
'{n}.Specimen.type', // Field #1
'{n}.Specimen.draw_date' // Field #2
  )
));
// view
echo $form->input('Aliquot', array('options' => 'aliquots', 'multiple'
=> 'checkbox'));

Alternatively, if you want the checkboxes grouped - say by specimen
type, then use this:

$this->set('aliquots', Set::combine($aliquots,
  '{n}.Aliquot.id',
  array(
'{0} [{1} / {2}]', // Format
'{n}.Aliquot.additive', // Field #0
'{n}.Specimen.type', // Field #1
'{n}.Specimen.draw_date' // Field #2
  ),
  '{n}.Specimen.type'
));
// view
echo $form->input('Aliquot', array('options' => 'aliquots', 'multiple'
=> 'checkbox'));

hth
grigri

On Jan 20, 2:32 pm, Tony Thomas  wrote:
> On Jan 16, 12:22 am, brian  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  wrote:
>
> > > I follow you up to this bit:
>
> > >> 
> > >> 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 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
-~--~~~~--~~--~--~---



Re: Label information for Multiple Checkboxes

2009-01-20 Thread Tony Thomas

On Jan 16, 12:22 am, brian  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  wrote:
>
> > I follow you up to this bit:
>
> >> 
> >> 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 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
-~--~~~~--~~--~--~---



Re: Label information for Multiple Checkboxes

2009-01-15 Thread brian

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).

On Thu, Jan 15, 2009 at 5:02 PM, Tony Thomas  wrote:
>
> I follow you up to this bit:
>
>> >
>> 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 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
-~--~~~~--~~--~--~---



Re: Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

I follow you up to this bit:

> 
> 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 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
-~--~~~~--~~--~--~---



Re: Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

I tried that very thing, but it didn't produce the expected results.
Maybe find('list', $options) isn't meant to accommodate more than a
single field. I'm not sure.

On Jan 15, 11:34 am, "David Coleman" 
wrote:
> You could also do something like this in your controller:
>
>             $aliquots = $this->Aliquot->find(
>
>                   'list',
>
>                   array(
>
>                         'fields'=>array(
>
>                               'Aliquot.id',
>
>                               'Aliquot.name'
>
>                               ),
>
>                         'conditions'=>array(
>
>                               // some conditions if necessary.
>
>                               )
>
>                         )
>
>                   );
>
> And then pass this to your view with
>
> $this->set(‘aliquotes’, $aliquots);

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RE: Label information for Multiple Checkboxes

2009-01-15 Thread David Coleman
Easy as cake my friend.

 

Just use this code, and build the list for your checkboxes...

 

$selected_users=array();

 

if (empty($this->data)) {

  $this->data = $this->Site->read(null, $id);

/*

  here you would replace the data=read with something like

  $ali_list =
$this->Aliquot->find('all',array('conditions'=>.)). and get whatever you
need to make a list of.

 

  As long as your models are set up correctly you should
have all the related data that you need to build your names

*/

  //below modify the references to $this->data. and
replace them with the array structure of $ali_list

  foreach($this->data['User'] as $user){

if(is_array($user)){

//extract($user,EXTR_PREFIX_ALL,'user');

  extract($ali_list,EXTR_PREFIX_ALL,'ali');

  if($user_id !=
$this->data['Site']['admin_id']){

$selected_users[$ali_id]=$ali_username;

  }

}

  }

}

 

Then use this code to display it.

 

input(

  'Category',

  array(

'type'=>'select',

'multiple'=>'checkbox',

'options'=>$categories,

'label'=>false

)

  );

?>

 

Don't worry about the 'label' = false.

 

What you are doing is making a multi select box with no label and displaying
the individual options as checkboxes.  Internally, cake will convert this to
checkboxes and labels.

-----Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Tony Thomas
Sent: Thursday, January 15, 2009 5:09 PM
To: CakePHP
Subject: Re: Label information for Multiple Checkboxes

 

 

On Jan 15, 1:03 pm, "David Coleman" 

wrote:

> Do you need checkboxes from multiple tables?  

 

No. The checkboxes in this case only pertain to my aliquots table so

that users can assign them to a box, which is in turn assigned to a

freezer. But in order to identify where the aliquots go, there are a

few fields from my specimens table (blood comes in as a specimen and

is then divided into aliquots) that I'd like to display in the label.

 

If so you need to use the

> trick I posted earlier today to make the hidden elements not be
duplicated.

> Overload your form.php in your app/views/helpers folder.

> 

> What you are doing is similar to a recent application that I wrote, in
which

> I developed this extention to the form->input method to accomplish just
this

> effect.

> 

> See the message "re: Ticket #5577 (new Enhancement)"  If this is what you

> need.

> 

> -Original Message-

> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On
Behalf

> 

> Of Tony Thomas

> Sent: Thursday, January 15, 2009 4:52 PM

> To: CakePHP

> Subject: Re: Label information for Multiple Checkboxes

> 

> The complicating factor here is that Aliquot belongs to Specimen in my

> model and I want to display some information from both tables:

> Specimen.type, Specimen.draw_date, Aliquot.additive & etc. It looks

> more and more like I'm going to have to put that information in an

> array and loop through it, building each checkbox one at a time

> instead of my example below. Or am I missing something?

> 

> On Jan 15, 11:01 am, grigri  wrote:

> > You need to set the $displayField property inside your `Aliquot` model

> > to whatever field you want for the label.

> 

> > On Jan 15, 4:47 pm, Tony Thomas  wrote:

> 

> > > I'm building a list of checkboxes like so:

> 

> > > echo $form->input('Aliquot.id', array( 'label' => FALSE,

> > >


> 'type' => 'select',

> > >


> 'multiple' => 'checkbox',

> > >


> 'options' => $aliquots));

> > > echo $form->input('box_id', array('options' => $boxes));

> 

> > > $aliquots above is built from $this->Aliquot->find('list', $options);

> > > which finds all the ids of the pertinent records. The problem I have

> > > this this only generates a list of ids. Is there good way to load an

> > > array for 'label' so that I can display more than just the list of
ids?


 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

On Jan 15, 1:03 pm, "David Coleman" 
wrote:
> Do you need checkboxes from multiple tables?  

No. The checkboxes in this case only pertain to my aliquots table so
that users can assign them to a box, which is in turn assigned to a
freezer. But in order to identify where the aliquots go, there are a
few fields from my specimens table (blood comes in as a specimen and
is then divided into aliquots) that I'd like to display in the label.

If so you need to use the
> trick I posted earlier today to make the hidden elements not be duplicated.
> Overload your form.php in your app/views/helpers folder.
>
> What you are doing is similar to a recent application that I wrote, in which
> I developed this extention to the form->input method to accomplish just this
> effect.
>
> See the message "re: Ticket #5577 (new Enhancement)"  If this is what you
> need.
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
>
> Of Tony Thomas
> Sent: Thursday, January 15, 2009 4:52 PM
> To: CakePHP
> Subject: Re: Label information for Multiple Checkboxes
>
> The complicating factor here is that Aliquot belongs to Specimen in my
> model and I want to display some information from both tables:
> Specimen.type, Specimen.draw_date, Aliquot.additive & etc. It looks
> more and more like I'm going to have to put that information in an
> array and loop through it, building each checkbox one at a time
> instead of my example below. Or am I missing something?
>
> On Jan 15, 11:01 am, grigri  wrote:
> > You need to set the $displayField property inside your `Aliquot` model
> > to whatever field you want for the label.
>
> > On Jan 15, 4:47 pm, Tony Thomas  wrote:
>
> > > I'm building a list of checkboxes like so:
>
> > > echo $form->input('Aliquot.id', array( 'label' => FALSE,
> > >                                                                        
>         'type' => 'select',
> > >                                                                        
>         'multiple' => 'checkbox',
> > >                                                                        
>         'options' => $aliquots));
> > > echo $form->input('box_id', array('options' => $boxes));
>
> > > $aliquots above is built from $this->Aliquot->find('list', $options);
> > > which finds all the ids of the pertinent records. The problem I have
> > > this this only generates a list of ids. Is there good way to load an
> > > array for 'label' so that I can display more than just the list of ids?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RE: Label information for Multiple Checkboxes

2009-01-15 Thread David Coleman

Do you need checkboxes from multiple tables?  If so you need to use the
trick I posted earlier today to make the hidden elements not be duplicated.
Overload your form.php in your app/views/helpers folder.

What you are doing is similar to a recent application that I wrote, in which
I developed this extention to the form->input method to accomplish just this
effect.

See the message "re: Ticket #5577 (new Enhancement)"  If this is what you
need.

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Tony Thomas
Sent: Thursday, January 15, 2009 4:52 PM
To: CakePHP
Subject: Re: Label information for Multiple Checkboxes


The complicating factor here is that Aliquot belongs to Specimen in my
model and I want to display some information from both tables:
Specimen.type, Specimen.draw_date, Aliquot.additive & etc. It looks
more and more like I'm going to have to put that information in an
array and loop through it, building each checkbox one at a time
instead of my example below. Or am I missing something?

On Jan 15, 11:01 am, grigri  wrote:
> You need to set the $displayField property inside your `Aliquot` model
> to whatever field you want for the label.
>
> On Jan 15, 4:47 pm, Tony Thomas  wrote:
>
> > I'm building a list of checkboxes like so:
>
> > echo $form->input('Aliquot.id', array( 'label' => FALSE,
> >                                                                        
        'type' => 'select',
> >                                                                        
        'multiple' => 'checkbox',
> >                                                                        
        'options' => $aliquots));
> > echo $form->input('box_id', array('options' => $boxes));
>
> > $aliquots above is built from $this->Aliquot->find('list', $options);
> > which finds all the ids of the pertinent records. The problem I have
> > this this only generates a list of ids. Is there good way to load an
> > array for 'label' so that I can display more than just the list of ids?




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

The complicating factor here is that Aliquot belongs to Specimen in my
model and I want to display some information from both tables:
Specimen.type, Specimen.draw_date, Aliquot.additive & etc. It looks
more and more like I'm going to have to put that information in an
array and loop through it, building each checkbox one at a time
instead of my example below. Or am I missing something?

On Jan 15, 11:01 am, grigri  wrote:
> You need to set the $displayField property inside your `Aliquot` model
> to whatever field you want for the label.
>
> On Jan 15, 4:47 pm, Tony Thomas  wrote:
>
> > I'm building a list of checkboxes like so:
>
> > echo $form->input('Aliquot.id', array( 'label' => FALSE,
> >                                                                             
> >     'type' => 'select',
> >                                                                             
> >     'multiple' => 'checkbox',
> >                                                                             
> >     'options' => $aliquots));
> > echo $form->input('box_id', array('options' => $boxes));
>
> > $aliquots above is built from $this->Aliquot->find('list', $options);
> > which finds all the ids of the pertinent records. The problem I have
> > this this only generates a list of ids. Is there good way to load an
> > array for 'label' so that I can display more than just the list of ids?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RE: Label information for Multiple Checkboxes

2009-01-15 Thread David Coleman
Odd, I'm using that very syntax and it works just fine...

 

$selected_users=array();

if (empty($this->data)) {

  $this->data = $this->Site->read(null, $id);

/*

  here you would do something like

  $ali_list =
$this->Aliquot->find('all',array('conditions'=>.)). and get whatever you
need to make a list of.

*/

  //below modify the references to $this->data. and
replace them with the array structure of $ali_list

  foreach($this->data['User'] as $user){

if(is_array($user)){

//extract($user,EXTR_PREFIX_ALL,'user');

  extract($ali_list,EXTR_PREFIX_ALL,'ali');

  if($user_id !=
$this->data['Site']['admin_id']){

$selected_users[$ali_id]=$ali_username;

  }

}

  }

}

 

I use this method for building a custom list in another section of my site.

 

Maybe you can modify this logic to assist with this issue.

 

Load ('all') to get the data you need and then pass through the list and
then use $this->set(.) to send it to the view.  

 

it's a little dirty :-(  

 

But it should produce the desired results :-)

 

Best luck friend.

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Tony Thomas
Sent: Thursday, January 15, 2009 4:43 PM
To: CakePHP
Subject: Re: Label information for Multiple Checkboxes

 

 

I tried that very thing, but it didn't produce the expected results.

Maybe find('list', $options) isn't meant to accommodate more than a

single field. I'm not sure.

 

On Jan 15, 11:34 am, "David Coleman" 

wrote:

> You could also do something like this in your controller:

> 

> $aliquots = $this->Aliquot->find(

> 

>   'list',

> 

>   array(

> 

> 'fields'=>array(

> 

>   'Aliquot.id',

> 

>   'Aliquot.name'

> 

>   ),

> 

> 'conditions'=>array(

> 

>   // some conditions if necessary.

> 

>   )

> 

> )

> 

>   );

> 

> And then pass this to your view with

> 

> $this->set('aliquotes', $aliquots);

 


 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RE: Label information for Multiple Checkboxes

2009-01-15 Thread David Coleman
You could also do something like this in your controller:

 

$aliquots = $this->Aliquot->find(

  'list',

  array(

'fields'=>array(

  'Aliquot.id',

  'Aliquot.name'

  ),

'conditions'=>array(

  // some conditions if necessary.

  )

)

  );

 

And then pass this to your view with

 

$this->set(‘aliquotes’, $aliquots);

 

 

 
<http://www.connaxis.com/>  <http://www.connaxis.com/>
<http://www.connaxis.com/>  <http://www.connaxis.com/>
<http://www.connaxis.com/>  <http://www.connaxis.com/> David Kenneth Coleman

Software Developer

 
………

United States: +
1 6468108783 Dept:  Development

Argentina:
+ 54 11 52465987  E-mail:<mailto:david.cole...@connaxis.com>
david.cole...@connaxis.com

The Netherlands:+ 31
208080017 Skype:   david.k.coleman

 

 

 

¡ <http://www.connaxis.com/>  <http://www.connaxis.com/>
<http://www.connaxis.com/>  <http://www.connaxis.com/>
<http://www.connaxis.com/>  <http://www.connaxis.com/> NEW! Please check out
our new  <http://www.creative-outsourcing.com/> Portfolio Website:

 <http://www.creative-outsourcing.com/> Connaxis Creative Outsourcing
Specialist  <http://www.creative-outsourcing.com/>
www.creative-outsourcing.com

First page position Google.com:
<http://www.google.com/search?hl=en&q=creative+outsourcing&btnG=Google+Searc
h> Creative Outsourcing

 

 

-Original Message-----
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Tony Thomas
Sent: Thursday, January 15, 2009 2:48 PM
To: CakePHP
Subject: Label information for Multiple Checkboxes

 

 

I'm building a list of checkboxes like so:

 

echo $form->input('Aliquot.id', array( 'label' => FALSE,

'type' =>
'select',

'multiple' =>
'checkbox',

'options' =>
$aliquots));

echo $form->input('box_id', array('options' => $boxes));

 

$aliquots above is built from $this->Aliquot->find('list', $options);

which finds all the ids of the pertinent records. The problem I have

this this only generates a list of ids. Is there good way to load an

array for 'label' so that I can display more than just the list of ids?


 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---

<>

Re: Label information for Multiple Checkboxes

2009-01-15 Thread grigri

You need to set the $displayField property inside your `Aliquot` model
to whatever field you want for the label.

On Jan 15, 4:47 pm, Tony Thomas  wrote:
> I'm building a list of checkboxes like so:
>
> echo $form->input('Aliquot.id', array( 'label' => FALSE,
>                                                                               
>   'type' => 'select',
>                                                                               
>   'multiple' => 'checkbox',
>                                                                               
>   'options' => $aliquots));
> echo $form->input('box_id', array('options' => $boxes));
>
> $aliquots above is built from $this->Aliquot->find('list', $options);
> which finds all the ids of the pertinent records. The problem I have
> this this only generates a list of ids. Is there good way to load an
> array for 'label' so that I can display more than just the list of ids?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

I'm building a list of checkboxes like so:

echo $form->input('Aliquot.id', array( 'label' => FALSE,

'type' => 'select',

'multiple' => 'checkbox',

'options' => $aliquots));
echo $form->input('box_id', array('options' => $boxes));

$aliquots above is built from $this->Aliquot->find('list', $options);
which finds all the ids of the pertinent records. The problem I have
this this only generates a list of ids. Is there good way to load an
array for 'label' so that I can display more than just the list of ids?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---