On Wed, Oct 20, 2010 at 9:53 AM, IWC <[email protected]> wrote:
> I want my users to select a Depot at login so that I can use the
> selected Depot to filter reports and enquiries. I have been trying to
> use LoadModel to populate a select list on my login form but it never
> does.

Because you'd need query the DB to actually get the data. Loading the
model would only be the first step. But that's not a good way to do
this, anyway.

> How do I do this? Is there a better way to achieve the same
> thing.

In your controller:

$this->set(
        'depots',
        $this->YourModel->Depot->find('list')
);

Then use $depots in the view to populate your select list.

This is assuming that YourModel is associated with Depot and that the
table has a depot_id column ('YourModel.depot_id' key in the form).

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to