Dynamically Update Fields Values

The OnValueChanged and OnMigration hooks can return an output that will be used to dynamically update fields values.

The output may be an Object structured as follows:

Property Type Description
updatesPreview Boolean Overrides the default behavior of preview update for the changed field. Note: OnValueChanged only
fields Object Contains all the fields to be updated. Each field may be specified using its name as property. The structure of the value is based on the field type.

Example:

function OnValueChanged() {
    return {
        "updatesPreview": true,
        "fields": {
            "name": {
                "value": "John"
            }
        }
    };
}

Field Values Structures Examples

BorderWidth

{
    "left": 1, //integer
    "right": 2, //integer
    "top": 3, //integer
    "bottom": 4 //integer
}

Checkbox

{
    "checked": true //boolean
}

Color

{
    "valueR": 128, //integer
    "valueG": 128, //integer
    "valueB": 128, //integer
    "valueA": 128 //integer
}

Colors

{
    "topR": 128, //integer
    "topG": 128, //integer
    "topB": 128, //integer
    "topA": 128, //integer
    "bottomR": 32, //integer
    "bottomG": 64, //integer
    "bottomB": 128, //integer
    "bottomA": 256, //integer
    "leftR": 32, //integer
    "leftG": 32, //integer
    "leftB": 32, //integer
    "leftA": 256, //integer
    "rightR": 0, //integer
    "rightG": 0, //integer
    "rightB": 0, //integer
    "rightA": 0 //integer
}

Dimension

{
    "width": 100, //integer
    "widthUnit": "Fixed", //"Fixed" or "Percent"
    "height": 50 //integer
}
{
    "value": "Option 1" //string
}

File

File fields cannot be updated.

FileList

FileList fields cannot be updated.

Font

{
    "family": "Helvetica", //string
    "size": 10.5, //float
    "bold": true, //boolean
    "italic": false //boolean
}

ImageSelect

ImageSelect fields cannot be updated.

Link fields cannot be updated.

Margins

{
    "top": 5, //integer
    "bottom": 5, //integer
    "left": 10, //integer
    "right": 10 //integer
}

Number

{
    "value": 12.5 //decimal
}

RoundCorners

{
    "topleft": 5, //integer
    "topright": 5, //integer
    "bottomleft": 5, //integer
    "bottomright": 5 //integer
}

Separator

Separator has no values.

Shadow

{
    "enabled": true, //boolean
    "blur": 10, //integer
    "spread": 5, //integer
    "offsetX": 0, //integer
    "offsetY": 2, //integer
    "colorR": 32, //integer
    "colorG": 32, //integer
    "colorB": 32, //integer
    "colorA": 256 //integer
}

SiteNodes

SiteNodes fields cannot be updated.

StringList

{
    "list": [ //string array
        "hello",
        "world"
    ]
}

Text

{
    "value": "Hello world!" //string
}