Saturday, September 27, 2008

find('list') that displays blank (combobox)

Hello everyone,

I'm creating a search page in my website and I want to take advantage
of cakephp's find('list') command.

Here is a snippet of my controller's code,

$collections = $this->Exhibit->Collection->find('list',
array(
'order' => 'Collection.name ASC',
'fields' => array('Collection.id', 'Collection.name')
));
$this->set(compact('collections'));


Now in here, I want to generate a list of collections with their
corresponding id and name.

For my view,

I have this one:

<?php echo $form->input('collection_id', array('label'=> false)); ?>

As you can see, it will try to create a combobox based from my
collections list. My problem is that since i'm doing a search here, I
want to have a blank field display at the top most of my combobox
which find('list') can't seem to handle.

Please help.

Thanks,

Mario


--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: