JavaScript Reference Guide

JavaScript reference guides

  • JavaScript Reference Home (this page)
  • JavaScript Wrappers
  • Form Functions
  • Workflow Functions
  • Global Helper Functions
  • JQuery Functions
  • Debugging help

The Evolve rules interface uses the Web browser's JavaScript engine. The Rule Wizard defines built-in rules, which are then converted to JavaScript when the form is run.

But if the Rule Wizard does not meet your needs, you can create and customize specific functions through advanced JavaScript rules, which are generally divided among the following: 

Function type Description
Form Functions General form functions used to manipulate form fields and elements, such as creating or hiding groups, reloading drop-down options, setting values in fields, and more.
Workflow functions Functions generally used and applied to Workflow Transitions to control workflow logic.
Global Helper Functions More discreet functions generally used to manipulate data in fields, and perform tasks such as converting text from upper case to lower case, averaging a set of values, returning the number of values in a repeating group, etc.
JQuery Functions A small set of helper functions that can be used by JQuery users.
Important:
  • You can permanently convert rules to JavaScript code, and/or create custom CSS styles for your forms.
  • Once a rule is converted to JavaScript code, it cannot be converted back to a built-in rule. From that point forward, the rule can be maintained only through the JavaScript code editor (not the rule wizard user interface).
  • Winshuttle Support cannot help you create or troubleshoot JavaScript.

Adding custom JavaScript/CSS to a form

The Solution Designer tree has two nodes where custom JavaScript Code and Custom CSS (Styles) are stored.

  1. Open Solution Designer.
  2. Open your solution file.
  3. Click the Solution tab.
  4. In the Solution pane, double-click either node (Javascript Code or Custom Styles) to open the built-in JavaScript or CSS code editor. (See example at right.)

You can also right-click a node to open the context menu, and edit the JavaScript/CSS references. The References dialogs allow you to insert links to JavaScript files or CSS files from any URL.

Accessing form field values

To access or modify a field, use $form.getValue and $form.setValue in the form.

You should not access DOM elements directly to manipulate the values. Doing so will disrupt proper event handling and rules propagation within the form renderer.

Using jQuery

The form renderer uses jQuery, which is available for use within rules.

Instead of using $ to access jQuery functionality, you should use the alias $j or use the full jQuery function name.

Exporting all Repeating Table data to Excel

New JavaScript rule is added to export data of all repeating tables on the Form into a single workbook with each table representing an Excel sheet in that workbook.

The name of Excel sheet is the name of the repeating table.

Limitations:

  • Two repeating tables should not have same name in the solution.

  • Repeating tables name of maximum 31 characters is acceptable in the solution.