Toggle menu

helper.updateFieldValue([pageName,] fieldName, value)

Updates the current value of a field.

This function has been deprecated. Use .setFieldValue instead.

This function behaves slightly differently depending on where it is used.

When working client-side updateFieldValue will only update the value of a field on the current page of the form. This will invoke the targeted field's registered update function, if available. Modifying the value of a field will trigger the execution of any handler property defined on the field.

The function can also be used in the control phase of your form (ie on next/back buttons). This allows you to target a field on any page of the form that already exists in the session by including the name of the page the field is on. It's not possible to update fields on future form pages that have not been visited yet as these pages and fields don't yet exist. The targeted field's handler will not be triggered (because handlers are only triggered client-side).

Executed

Client-side and server-side.

Arguments

ArgumentTypeDescription
pageNameStringRequired in the control phase, not available client-side
fieldNameString, requiredThe name of the field to be updated
valueJavaScript simple type, requiredThe new value of the field

Example

In this example updateFieldValue is used in a field handler and combined with .getVariable to update 'FIELD4'.

function (helper) {
  helper.updateFieldValue('FIELD4', helper.getVariable('myVariable'));
}

This example has been added to the next function of a wizard button. It updates the value of a field on a page that has just been visited.

function(helper, defaultPage, sessionData) {
    helper.updateFieldValue('PAGE1', 'FIELD2', 'A different value');
    return defaultPage;

Last modified on September 26, 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon