Have you tried Set::combine($issuerArray, '.issuerID',
'.issuerName' );
On 2/24/08, Ronald <ronaldve xs4all.nl> wrote:
>
> I know that, but the data does not come from my
database, but from an
> API that delivers it in a specific format.
> I just need to know what I have to do with the
$issuerArray to turn it
> over to another array that I can return to the
controller that is
> calling this component and from there use it to fill
my selectbox in
> the view.
>
> The $issuerArray looks like this:
>
> Array
> (
> [0] => IssuerBean Object
> (
> [issuerID] => 0151
> [issuerName] => Issuer Simulator
> [issuerList] => Short
> )
> )
>
> The best thing I've come to is this:
>
> --- in my component function doDirectoryrequest():
---
>
>
> for($i = 0; $i < count($issuerArray); $i++)
> {
>
> $keys[$i] = $issuerArray[$i]->issuerID;
> $values[$i] = $issuerArray[$i]->issuerName;
> }
>
> $issuers = array_combine($keys, $values);
>
> return $issuers;
>
> --- in my controller: ---
>
> $this->set('result',
$this->Ideal->doDirectoryrequest());
>
> --- in my view: ---
>
> <?php echo $form->select('issuer',
array('options' => $result,
> array(), array(), false)); ?>
>
> ---
>
> This is resulting in this html code:
> <select name="data[issuer]"
id="issuer">
> <option value=""></option>
> <optgroup label="options">
> <option value="0151">Issuer
Simulator</option>
> </optgroup>
> <optgroup label="1">
> </optgroup>
> <option value="2"></option>
> </select>
>
> But somehow there's a lot of stuff in there I don't
want to have.
> I just need this :
> <select name="data[issuer]"
id="issuer">
> <option value="0151">Issuer
Simulator</option>
> </select>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Cake PHP" group.
To post to this group, send email to cake-php googlegroups.com
To unsubscribe from this group, send email to
cake-php-unsubscribe googlegroups.com
For more options, visit this group at http://
groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
|