Hi

I am trying to populate a combo box dynamically. The code snippet of
what I am doing is as follows. populateUserList the javascript that
will be called on a button click event. Inside populateUserList,
loadJSONDoc('/configure/json_users') is called. json_users simply
returns a list of user names.

makeupdate is the callback function which populates the combo box. Now
this code is not working. Can anyone please guide me as to what is
wrong in this code.


//Python//

@turbogears.expose(format = 'json', allow_json = True)
def json_users(self):
        users = ['lila','lola','lyla']
        return dict(users = users)

//Javascript//
function populateUserList()
{
        alert ("in populate");
        var d = loadJSONDoc('/configure/json_users');
        d.addCallback(makeupdate);
}

function makeupdate(userlist)
{
        var list = SELECT({'id':'userlist'},map(OPTION, userlist));
        swapDOM('userlist', list);
}

//html code//
<html>
<body>
   <select id="userlist">
   </select>
</body>
</html>

(Is it that javascript cannot understand a python list)

Thanks and Regards
Roopesh


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"MochiKit" 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/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to