Anyway ...

Say you have a table, 'regions', with columns 'id' & 'name':

$this->set('regions', $this->Region->find('list'));

Or, if this is an associated model:

$this->set('regions', $this->Country->Region->find('list'));

View:

<?= $form->select('Country.region', $regions, null, array(), true) ?>

Use different column name:

$this->Country->Region->displayField = 'name_en';
$this->set('regions', $this->Country->Region->find('list'));

On Sat, Feb 23, 2008 at 6:52 PM, b logica <[EMAIL PROTECTED]> wrote:
>
> On Sat, Feb 23, 2008 at 2:59 PM, Ronald <[EMAIL PROTECTED]> wrote:
>  >
>  >  It's probably something simple, but I'm trying to figure this out for
>  >  a few hours now and I just can't get it right.
>  >
>  >  I'm building a component and one function needs to return an array I
>  >  can use to fill a selectbox.
>  >  This return array needs to be filled from an array of objects,.
>  >
>  >  This is my loop to walk trough the array of objects.
>  >  ---
>  >  for($i = 0; $i < count($issuerArray); $i++)
>  >  {
>  >         //$issuerArray[$i]->issuerID           <- this needs to be the id 
> of
>  >  every option
>  >         //$issuerArray[$i]->issuerName;     <- this needs to be the value 
> of
>  >  every option
>  >  }
>  >  ---
>  >  My question is how to get these values into a array (the return array)
>  >  in such a way that I can use it to fill an selectbox.
>  >  I tried several things but I allways end up with a selectbox with all
>  >  kind of strange values in it.
>  >
>  >  >  >
>  >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to