Got it, Thanks Dardo.
On Dec 1, 4:23 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> There are thre ways:
>
> 1. If you are using Model::generateList(), ex:
>
> // generateList ($conditions, $order, $limit,
> $keyPath=, $valuePath)
> $categories = $this->Category->generateList(null, null, null, null,
> '{n}.Category.catname');
>
> 2. Also you can just set Model::$displayField :
>
> class Category extends AppModel {
> var $name = 'Category';
> var $displayField = 'catname';
>
> }
>
> Then, it becomes:
>
> $categories = $this->Category->generateList();
>
> 3. You can rename colmn catname to name (default displayField).
>
> I think number 2 is best.
>
> Dardo Sordi.
>
> 2007/11/30, Joyce <[EMAIL PROTECTED]>:
>
>
>
> > Hi all,
>
> > I am a newbie in cakePHP, and I have created a table as per below.
>
> > I have 3 fields for my categories table, and would like to create a
> > Select form element to insert new categories and link within the table
> > itself(where the parent_id comes from the id).
>
> > Such that it will echo the select option in this manner:
> > <select><option value="id">catname</option></select>, where the values
> > of "id" and "catname" are populated from the table below.
>
> > categories table:
> > id
> > catname
> > parent_id
>
> > I have tried some of the ways that will google help, but none seems
> > successful, in which I could only end up with the id instead of
> > catname.
>
> > Please advise. Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---