You can pass fields names to find directly:
$clientes = $this->Cliente->find(
'list',
array(
'fields' => array('Cliente.codigo', 'Cliente.razaoSocial'),
'order' => array('Cliente.razaoSocial ASC')
)
);
On Oct 15, 3:41 am, "Leonardo \"Hackin\" Freire" <[email protected]>
wrote:
> Hi dudes,
> I'm getting a little problem when populate a select through the
> $form->input.
>
> In my controller "Contato", where i save the client_id field, I populate an
> variable calling "clientes" with this line:
>
> $clientes = $this->Cliente->find('list', array('order' =>
> array('Cliente.razaoSocial ASC')));
>
> In my view, I uses:
> <?php echo $form->input('cliente_id', array('options' => $clientes, 'label'
> => '', 'empty' => 'selecione um cliente', 'class' => 'campoform')); ?>
>
> In my "Cliente" model, I set the primayKey as "codigo" and displayName as
> "razaoSocial". The codigo field is a text field with letters and numbers.
> The variable populates ok and, in my insert action of Contato controller,
> everything is ok: the data is saved and the input field too.
>
> But, in my update action, the $form->input, that renders in a form of
> select, don't select the right value. =/
>
> Ex.: I'm saved a client_id value "J51", and in my update view this not
> select;
> Ex.: I'm saved a client_id value "290-1", and in my update view this select
> more than one single value;
>
> Somebody helps me or this is a bug/limitation from Cake ?
>
> Hug.
>
> Leonardo C. Freire
> Diretor Executivo
> +55 27 97230015
> [email protected]http://www.leohackin.com.br
>
> Giran Soluções e Ensinohttp://www.giran.com.br
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---