Search.../

onItemValuesChanged( )

Adds an event handler that runs when a value of the current item changes.

Description

The onItemValuesChanged() function allows you to optionally perform actions right after the current item's values change. The item's value changes when a user changes the value in one of the item's connected page elements or you change the value programmatically.

Calling onItemValuesChanged() on a read-only dataset causes an error.

Syntax

function onItemValuesChanged(handler: ItemValuesChangedHandler): void
handler: function ItemValuesChangedHandler(itemBeforeChange: Object, updatedItem: Object): void

onItemValuesChanged Parameters

NAME
TYPE
DESCRIPTION
handler

The current value changed event handler.

Returns

This function does not return anything.

Return Type:

void

ItemValuesChangedHandler Parameters

NAME
TYPE
DESCRIPTION
itemBeforeChange
Object

The item before the change.

updatedItem
Object

The updated item.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

Register a callback to run when the current item's values change

Copy Code
1$w("#myDataset").onItemValuesChanged( (itemBeforeChange, updatedItem) => {
2 let oldValue = itemBeforeChange.fieldName;
3 let newValue = updatedItem.fieldName;
4} );