Please enable JavaScript to view this site.

Process Designer

It is possible to pass functions as parameters in JavaScript. A function passed as a parameter is called a callback function. This allows executing any function in the context of the executing function. This concept is often used to ensure that a specific function will only be executed after the executing function or parts of it are processed. Especially asynchronous AJAX calls require this concept and it is frequently used for them.

Some functions of the JavaScript API (especially those that dynamically reload or refresh form elements) have a callback function as parameter. This gives you a high flexibility to deal with specific events yourself and give you extensive control over the triggered behavior. The respective functions usually offer the possibility to pass a callback function for a successful execution and a callback function in case an error occurs.

For more information on callback functions, see:

http://learn.jquery.com/about-jquery/how-jquery-works/#callbacks-and-functions

http://www.w3schools.com/jquery/jquery_callback.asp

Please note: When passing a callback function, only the function name itself is specified. It is not to be enclosed by single or double quotation marks. Furthermore, no parentheses after the function name are allowed.

Please note: If you have included multiple JavaScript scripts in a dialog in a process, please ensure that the callback functions have unique names. Otherwise, it is not possible to ensure which callback function is called.

Correct example:

function mySqlTextboxSuccessCallback() { … };

function mySqlTextboxErrorCallback() { ... };

jr_sql_refresh("my_sqltextbox", mySqlTextboxSuccessCallback, mySqlTextboxErrorCallback);

Incorrect example 1:

function mySqlTextboxSuccessCallback() { … };

function mySqlTextboxErrorCallback() { ... };

jr_sql_refresh("my_sqltextbox", "mySqlTextboxSuccessCallback", "mySqlTextboxErrorCallback");

Error: The callback functions are passed as String.

Incorrect example 2:

function mySqlTextboxSuccessCallback() { … };

function mySqlTextboxErrorCallback() { ... };

jr_sql_refresh("my_sqltextbox", mySqlTextboxSuccessCallback(), mySqlTextboxErrorCallback());

Error: Instead of passing them, the callback functions are directly executed.