Hi Guys,
I create a form containing a dual list which should be filled with group names and select the items assigned to the user. Its triggered by an user selection field and the code is working when I call them separately but as the ca_fdFetchSelectData function is called asychnonous and takes about 10 seconds (even when the db statement runs in milliseconds) to fill the dual list, the select statements run before the fetch is done.
How can I be sure, that the fetch is done before starting the select statements?
Here the code:
// select the groups
ca_fdFetchSelectData(ca_fd.formId, 'sd_groups');
// assign associated groups
ca_reportQuery('sd.mygroups', {'userid':ca_fdGetTextFieldValue('form_ca_servicedesk','benutzerid')}, function test(result) {
if (result.length > 0){
for (i=0; i<result.length; i++){
ca_fdSelectOption(ca_fd.formId, 'sd_groups', result[i]['name'],result[i]['name']);
}
}
}, null);