Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

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

​ It is required to 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, a utility function has to be created in one of the Wizard-level onLoad actions:

Wizard On-load Action:

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

wizardState.lastChange = oldValue + ' -> ' + value


  • No labels