PDA

View Full Version : Reloading combo box from amfphp


llebron
03-17-2005, 01:34 PM
I am working on a flash application to manage users. When the form loads up it creates a combo box with the name of all the users. Here's the code

function get_users_Result(result) {
length = result['items'].length;
getItems_cb.addItem({label:' -- Please select a user --'});
for($i=0; $i < length; $i++)
{
getItems_cb.addItem({label:result['items'][$i]['First_Name']+' '+ result['items'][$i]['Last_Name'], data:result['items'][$i]['UserID']});

}
}

get_users = users.get_users("");


This works. However, when I add or delete an user I want to regenerate the combo box. I tried the following code but the combo box does not get regenerated, eventhough the get_users method gets called.

function add_user_Result(result) {
trace(result);
get_users = users.get_users("");
}


Any help would be greatly appreciated.

thanks

Luis :confused:

prt1
03-20-2005, 08:23 AM
The normal way is to check the 'add' worked in the php file and return the list of Users if true. This way you only make one call.
You have no error checking in your 'result' function, how do you know the 'add' worked?
Looking at your code there doesn't seem to be anything that clears the combo box before refreshing it, it is just adding onto the end of it.
Hope this helps.