Short answer: yes.

Create a LocationType model
Location belongsTo LocationType

In your location controller, do something like:
$types = $this->Location->LocationTypes->find('list')

and set the $types variable for the view:
$this->set(compact('types'));

In the view, you can then do:
echo $form->input('Location.type_id',array('type' => 'select',
'options' => $types));



On Sep 16, 12:00 am, Diptanjan <[email protected]> wrote:
> Hi,
>
> I am new to Cake. It's been only few days I am trying to learn Cake
> for my new project purpose.
>
> I need to build a Location page which will contain the following form
> fields:
>
> location name
> location type
> location description
> location description
>
> So far I am able to List, Add, Edit and Delete the locations added
> (till now I was using text boxes for all).
>
> Now I need to display dropdown for location type which is populated
> from DB (table name is : listing lookup), from where the admin can
> select the location type instead of typing it.
>
> 1. Do I need to create a seperate controller and model file to do
> this?
> 2. Even if I do that how can I fetch the data in my View?
>
> I tried to search the net but unable to find something that can help
> me (might be as I am begeinner in CAKE I am unable to use what I found
> so far :) )
>
> Can anyone help me with this ?
>
> Thanks in Advance
>
> Diptanjan
--~--~---------~--~----~------------~-------~--~----~
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