Hi
I’m dynamically creating tabs with form in the tabs and populating the global array with a for loop.
But when I’m trying to setItemValue, for the form items it can’t find the global array. Can DHTMLX handle dynamic array or variables?
Thanks
[code] function app1(id) {
dhxWins = new dhtmlXWindows();
dhxWins.attachViewportTo(“winVP”);
w1 = dhxWins.createWindow(“w1”, 200, 50, 750, 450);
w1.maximize();
w1.setText(“Connection(”+id+") Info to BBI");
tabbar_1 = w1.attachTabbar();
for (var iAA = 0; iAA < 5; ++iAA) {
var count = iAA+1;
tabbar_1.addTab("a"+iAA, "Connection "+count+":"+bandwidth_fields[iAA]);
add_layout = new Array();
cell_1a = new Array();
cell_2b = new Array();
add_client = new Array();
add_layout[iAA] = tabbar_1.tabs("a"+iAA).attachLayout("2U");
cell_1a[iAA] = add_layout[iAA].cells('a');
cell_1a[iAA].setText("Connection Info");
cell_1a[iAA].setWidth(400);
add_client[iAA] = add_layout[iAA].cells("a").attachForm();
add_client[iAA].enableLiveValidation(true);
add_client[iAA].loadStruct('./data/accept_quote_client_info_form.php', function(){
add_client[iAA].setItemValue("c_lat", "0"); //Error Uncaught TypeError: Cannot read property 'setItemValue' of undefined
add_client[iAA].setItemValue("c_long", "0");//Error Uncaught TypeError: Cannot read property 'setItemValue' of undefined
});
cell_2b[iAA] = add_layout[iAA].cells('b');
cell_2b[iAA].setText("Connection Location");
cell_2b[iAA].attachURL('maps.php?sm_use=y&new_con=y&formname=add_client|'+iAA);
}
}
function app2(iAA,coord,type) {
add_client[iAA].setItemValue("c_lot", "-25.00");//Error Uncaught TypeError: Cannot read property 'setItemValue' of undefined
add_client[iAA].setItemValue("c_lon", "-25.00");//Error Uncaught TypeError: Cannot read property 'setItemValue' of undefined
}[/code]