Toggle menu

Timer

The timer field executes its handler when the timer starts, stops, or after a set period. The timer countdown can be set to start on page load or triggered by another event using the startTimer() custom function. The execution can occur once or on repeat.

Field Values and the Handler

Like any field, the timer's handler is triggered when the field's value changes. The timer has three possible values, timerStart (set when the timer starts), timerTrigger (set when the interval is reached if the timer is on repeat) and timerStop (set when the timer is reached or stops repeating). When writing your handlers you can specify what the timer does at each of these points. If you don't, the handler will be triggered at each stage (ie when the timer starts, when the timer is triggered, and when the timer stops).

Custom Functions

Custom functions can be called from the handlers of other fields using .invokeCustomFieldFn.

  • startTimer() - starts the timer
  • stopTimer() - stops the timer
  • changeRepeat(newrepeat) - a boolean to toggle the repeat property between true and false
  • changeInterval(newInterval) - an integer value to change the interval to

Properties

LabelDescriptionType Name
Interval (milliseconds)The number of milliseconds until the handler function is calledINTERVAL
On LoadEither true or false for whether or not the timer should start counting down on page loadONLOAD
RepeatIf true the timer will repeat using the set interval. If false the timer will only fire onceREPEAT
HandlerThe JavaScript function that will be executed when the timer reaches zero or the field value changesHANDLERS
DocumentationAdd documentation to your field to help explain any complex functionality to future users. You might include information on what the field does and how it relates to other fields on the form. Notes added here are only ever visible in the Forms Designer, they can be searched for, viewed and downloaded from the action panel. See Common Field Properties for an exampleDOCUMENTATION

Examples

This example imagines a timer that will hide then reveal another field. It is started by someone pressing a button.

The timer field has been set up like this:

Timer Field
 

The handler on the timer field hides a field when the timer starts, then reveals the field when the time runs out:

Timer Handler
 

To start the timer, a script button invokes the timer's custom function:

Start Timer Custom Function
 

Last modified on March 02, 2022

Share this page

Facebook icon Twitter icon email icon

Print

print icon