Help with variables please

Hi,
I need to return the value of a global variable into a method, and I am having some trouble.

Below is the code, basically I want to return the value of “formname” into the below method.

So if the formname variable = invoice_data_entry below would be

form.invoice_data_entry.cust_name = org_name;

var formname = globals.statusForm

form.formname.cust_name = org_name;

//close popup box
application.closeFormDialog()

I hope this make sense

PJR

try

form[globals.statusForm].cust_name = org_name;