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
| Parameter | Type | Description |
|---|---|---|
|
| The prefix of the |
|
| An object where keys correspond to the suffix of the input |
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"