Skip to content

Editor / DOM Helper / setFormValues

Function: setFormValues()

ts
function setFormValues(prefix, values): void;

Sets values into form inputs identified by a specific prefix in their id.

It searches for elements with an id starting with node-input-{prefix}- and assigns the provided values. For checkboxes, it sets their checked state to true or false. For other inputs (e.g., text, select), it sets their value.

Parameters

ParameterTypeDescription

prefix

string

The prefix of the id to identify the form inputs.

values

Record<string, unknown | boolean>

An object where keys correspond to the suffix of the input id, and values are the corresponding input values.

Returns

void

Example

typescript
// HTML
// <input type="checkbox" id="node-input-settings-enabled" />
// <input type="text" id="node-input-settings-username" />

setFormValues('settings', { enabled: true, username: 'JaneDoe' });

// Results in:
// Checkbox with id="node-input-settings-enabled" is checked
// Input with id="node-input-settings-username" has value "JaneDoe"

Version v1.33.1 - Built on 2026-03-28