Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On Value Change Parameter

On Value Change is a JavaScript expression that is executed any time value of the field is changed. ​You can use it to reference any input fields, including Field Groups. For Field Groups, the expression is executed when the value any of the nested field is changed. ​ For Repeatable Field groups, the expression is executed when new items are added or removed and when any of the nested fields within any item are changed. In addition to the standard Field Execution Context variables, On Value Change has one more:

Name

Type

Description

oldValue

any

Previous value of the field. Type of the value depends on the field type

On Item Change

On Item Change expression is available for Repeatable Field Groups and allows tracking changes of a particular item. ​ model.getIndex() can be used within On Item Change expression to get the index of a changed item. ​

Updating starting point data within On Value Change

​You must delay any updates performed from On Value Change to startingPointData and model using a 0ms $timeout. ​ Because $timeout is not available in Field Execution Context, you must create a utility function in one of the Wizard-level onLoad actions:

Wizard On-load Action:

Code Block
languagejs
if ($scope.dspSession == undefined) {
  $scope.dspSession = {}
}

$scope.dspSession.handleMyValueUpdate = function (value, oldValue) {
  $timeout(function () {
    var time = (new Date()).toLocaleDateString()

    $scope.addStartingPointData(
      'LastUpdate',
      oldValue + '-' + value + ' (' + time + ')'
    )
  })
}
 On Value Change expression:
dspSession.handleMyValueUpdate(value, oldValue)

Example

Code Block
languagejs
wizardState.lastChange = oldValue + ' -> ' + value

...