The JavaScript - Button Control allows designers to add JavaScript code that is executed when the button is triggered.
This Control is part of the Intermediate Control pack, and will only be available if your System has the appropriate licence.
How To
Add a JavaScript - Button to the Page. The options and style can be configured in the Options tab and Styling tab of the Field Properties.
JavaScript - Button Fields can be styled in a Stylesheet by referencing the control-javascript-button class.
To configure the code to be executed, use the Code Editor in the Advanced Options tab.
The JavaScript - Button Control 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 Calculate on the Page to re-run its content.
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 Intelligent Agent by placing it within the custom.js file. 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 Fields, it is possible to require that a Page passes 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 Fields, upon activation the button will then be temporarily disabled until the action has completed.
As with other button-type Fields, 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.