Context Variables

Context variables are an extremely powerful tool in accessing extra information during runtime.  In all cases, context variables in SPARK are associated with the specific event handlers. 

Example 1

This example is intended to demonstrate that context variables are associated with an event handler by using a debugger tag.  For this example, an Integer control is used.


When the page loads, there is no value in the Integer control.

Typing a number in the Integer field will invoke the On Change event into debugging mode.  As soon as the user clicks outside of the control (loses focus), the debug mode is invoked.

Notice the first line of code under the tab VM69, there are two unique variables (context variables) that are accessible.We want to know what the value was before the user made a change; to do so we type the variable name oldValue into the console, which returns null (this is expected since the Integer Control was not populated when the page loaded.) Now, we want to know the new value, to access that we type in newValue, in this case, it returned 50.

 Example 2

This example will show how to use context variables.

The configuration options for the Tooltip (Control Id: Tooltip1).

The On Change Event for the Integer control.

This is the result...

When 50 is entered the Tooltip isn't displayed since the New Value (50) is greater than null (no value when the page first loads).

When 25 is entered the Tooltip is triggered, since 25 is less than 50.

A lot of the SPARK controls are accompanied with context variable(s).  To see whether there are context variables associated with an event handler for a control check out the SPARK documentation.  

The one page reference can be found here.  From there, you can navigate to the JS Doc for a particular control. Note: You must be signed in. 

Once you are in the JS Doc you can find the available context variables in the Events section.


  • Author: Courtney Silva
  • Date Created: October 30, 2015
  • Date Modified: October 30, 2015
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request