Help with setting values of a listbox dynamically

I have 2 fields on my custom control, a text box and a listbox. The choices for the listbox are to come from the text box (ReqFiles). So, if the user types in “red, blue, green”, then I want those to be 3 choices in the listbox field. I can’t get the listbox choices to compute. Here is my code for the values of the listbox:

if (getComponent(“ReqFiles”) != null)

{

var reqlist = getComponent(“ReqFiles”).getValue();

if (reqlist == “”)

{

return("");

}

else

{

listarr = reqlist.split(",");

return(listarr);

}

}

I’m still new to js, so it may not be the most efficient piece of code - but why won’t it work?

Any ideas?

Thanks,

Bob