Editor / DOM Helper / getFormValues
Function: getFormValues()
ts
function getFormValues(prefix): Record<string, string | boolean>;Retrieves values from form inputs within a specific prefix in their id.
It searches for elements with an id starting with node-input-{prefix}- and extracts their values. For checkboxes, it returns a boolean (true or false). For other inputs (e.g., text, select), it returns their value as a string.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| The prefix of the |
Returns
Record<string, string | boolean>
An object where keys are derived from the input id, and values are the corresponding input values.
Example
typescript
// HTML
// <input type="checkbox" id="node-input-settings-enabled" checked />
// <input type="text" id="node-input-settings-username" value="JohnDoe" />
const values = getFormValues('settings');
console.log(values);
// Output: { enabled: true, username: 'JohnDoe' }