RUNJS CONTROL

runjs custom control

Unique Custom Control

The RunJS is a FREE Custom SmartForm Control that gives form designers a way to execute JavaScript functions from a rule in a K2 SmartForm. Form designers often inject JavaScript snippets into a form or view using a data label control. The RunJS control is similar to a data label with an important difference. The RunJS control has a JavaScript on change event that calls the JavaScript function named in the text property of the control. If we transfer a function name and parameters to the control, the function is executed immediately. This provides a way to execute a custom JavaScript function from within a rule in a form or view. The RunJS control therefore allows us to let SmartForm events and conditions determine if and when a JavaScript function is executed, and to also map JavaScript function parameters using SmartForm expressions. It is a very simple custom control and yet makes it easy to leverage JavaScript in SmartForm solutions.

WORKING EXAMPLE

The RunJS download file includes a working SmartForm example. In the example, the JavaScript function setCheckBox() will execute after the rows and columns in a list view are rendered. The setCheckBox() JavaScript function then replaces controls loaded by the list view with check box controls that are mapped to a list view property.