Hi,

I got stuck for a few days, try searching but no luck. Do anyone has a
solution for this problem?

What I'm trying to do is that the admin is able to change the author
of the page by selecting in the dropdown list. Just like wordpress.
Btw, I using cakephp 1.2 RC2.

user association: hasMany
page association: belongTo

So I wrote this:

user.php
        function getUserList() {
                $userlist = $this->find('list', array('fields' =>
array('User.username')));
                return $userlist;
        }

users_controller.php
                $userlist = $this->User->getUserList();
                $this->set('userlist', $userlists);

admin_edit.ctp
                pr($userlist);

And I get:

Array
(
    [1] => admin
    [9] => bser1
    [2] => user2
    [3] => user3
    [4] => user4
    [5] => user5
    [6] => user6
    [7] => user7
    [8] => user8
)

And the dropdown list has all the username, so far no issue. But when
I'm trying to call this function in my pages_controller.php

$userlists = $this->User->getUserList();
$this->set('userlist', $userlists);

and try pr() in the view and I get:

Array
(
    [1] =>
    [9] =>
    [2] =>
    [3] =>
    [4] =>
    [5] =>
    [6] =>
    [7] =>
    [8] =>
)

No value only the id for the list of user, thus my dropdown box is
blank. I check the id, it is the id for the user table.

Hope someone can help me out.

Thank in advance

--~--~---------~--~----~------------~-------~--~----~
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