JobRouter allows you to prevent a process step from being sent using a script. This can be useful if, for example, you want to validate your entries yourself. You can use the following functions to do this. These only work when sending the dialog, i.e. in the OnSubmit event.
Please note: With asynchronous execution of JavaScript, the correct execution of the API functions jr_enable_send, jr_disable_send and jr_allow_send cannot currently be guaranteed. API functions such as jr_execute_dialog_function with subsequent execution logic in the successCallback should therefore be avoided.
The function allows a step to be sent. By default, sending of a step is always allowed.
The function does not return a value.
Please note: The API function jr_allow_send can be used alternatively to the API function jr_enable_send.
Example: Allow sending a step
var performOnSubmit = function() {
// Disallow sending the step
jr_disable_send();
// Validation in progress
var validationResult = myValidationCall();
// If the validation is successful, sending the step is allowed again
if (validationResult) {
jr_enable_send();
}
}
By executing this function the sending of the step is prevented. By default, sending of a step is always allowed.
The function does not return a value.
Please note: The API function jr_allow_send can be used alternatively to the API function jr_disable_send.
Example: Disallow sending a step
var performOnSubmit = function() {
jr_disable_send();
}
The function allows or prohibits a step to be sent depending on the passed parameter value. By default, sending of a step is always allowed.
Parameter |
Type |
Description |
|---|---|---|
value |
boolean |
Optional true: Sending is enabled. false: Sending is disabled. |
The function does not return a value.
Please note: The API functions jr_enable_send und jr_disable_send can be used alternatively to the API function jr_allow_send.
Example 1: Allow sending a step
// 1st version
var performOnSubmit = function() {
// Disallow sending the step
jr_allow_send(false);
// Validation in progress
var validationResult = myValidationCall();
// If the validation is successful, sending the step is allowed again
if (validationResult) {
jr_allow_send(true); // or: jr_allow_send()
}
}
// 2nd version
var performOnSubmit = function() {
// Validierung erfolgt
var validationResult = myValidationCall();
// If the validation is successful, sending the step is allowed again, otherwise sending the step is forbidden again.
jr_allow_send(!!validationResult);
}
Example 2: Disallow sending a step
var performOnSubmit = function() {
jr_allow_send(false);
}