The JavaScript - Button allows users to add JavaScript code that is executed a when the agent clicks a button.
This control is part of the Intermediate control pack, and will only be available if you have the appropriate licence part.
How To
Add a JavaScript - Button to the Workflow Page. The button's text and style can be configured in the
Options and
Styling tabs of the Field Properties.
To configure the code to be executed, use the
Code Editor in the Advanced Options tab.
The JavaScript - Button has one unique option available in its Options tab:
Option
|
Description
|
Run Calculations
|
If enabled, then Page calculations will be triggered once the JavaScript - Button has finished executing its contained code. This will update the front-end values of any affected Fields, and trigger any Calculates on the page to run.
|
Notes
Refer to the
Code Execution article for specific details as to JavaScript execution order and variable scope.
The JavaScript - Button is most commonly used to allow an agent to trigger multiple actions within a Page with a single click. For example, it can be used to trigger a JavaScript function or some other actions before using
.click() on a hidden button that controls page navigation.
It is also possible to define variables or functions globally across an entire installation of Scripting by placing it within
custom.js. This is an advanced action with potentially dangerous outcomes if implemented improperly, please see
this Knowledge Base article for further information.
As with other button-type controls, it is possible to require a Page pass
validation before the button will activate. This prevents the JavaScript content from being executed before all requisite details have been collected.
As with other button-type controls, upon activation the button will then be disabled until the action has completed.
As with other button-type controls, it is possible to trigger this by JavaScript or
Update Links. Please see the
.click() article for more information and an example regarding using JavaScript.