Implement callback

I need to implenemt a callback in order to wait for the server execution:
var currentFileId = frmFileIdAction.saveData(‘data[0].fileid’);
here I would to make sure that the server is ready to accept a call before I execute this:
General.fetchData(null, “frmGeneral.setValues(data[0])”);
I tried to have a function call in the following:
frmFileIdAction.saveData(function(){CheckState();}, ‘data[0].fileid’);
function CheckState () {
alert(1);
}
but I am getting error.
Am I doing it correctly?
The error btw comes out from the ISC code.

Hi Mark

What is frmFielIdAction? A DynamicForm?
If so what is the “data[0].fileid” parameter for?

If it’s a dynamicForm and you want to save the editedValues you should be able to just do:

frmFileIdAction.saveData(function () {checkState()});

or even

frmFileIdAction.saveData("checkState()");

If this is still not working for you - what is the error you’re seeing? In IE you should actually see a stack trace in the log window, which may help us to see what’s going wrong.

Thanks
Isomorphic Software

Well, while the callback call works now I am not getting what I need with it.
frmFileIdAction.saveData(function () {checkState()});
General.fetchData(null, “frmGeneral.setValues(data[0])”);
function checkState(){
alert(1);
}
checkState function is getting called too late.
The following provides correct functionality:
frmFileIdAction.saveData(function () {checkState()});
alert(1);
General.fetchData(null, “frmGeneral.setValues(data[0])”);
I need something like data island’s “ondatasetcomplete” checked before I call next function. Can you tell me what’s available?
Thanks

Hi Mark
The saveData callback fires when the save has completed, and the data is available on the server.
I’m not sure exactly what your usage is, but if you want to call your ‘General.fetchData(…)’ code after the save has completed, just put the call into your callback function. For example:

frmFieldAction.saveData("checkState()")

function checkState () {
    General.fetchData(null, "frmGeneral.setValues(data[0])");
}

If this isn’t what your after, can you give us more details on what you’re trying to achieve?
Thanks

Yes, that’s exactly what I did. Thanks