Try this at your component:
var $issuers = array();
function doDirectoryrequest() {
$issuerArray = array('YOUR DATA');
foreach($issuerArray as $issuer)
{
$this->issuers[$issuer['issuerID']] = $issuer['issuerName'];
}
return $this->issuers;
}
And keep your controller and view the same.
Johan de Jong
On 24 feb, 14:24, Ronald <[EMAIL PROTECTED]> 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 [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
-~----------~----~----~----~------~----~------~--~---