Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Utilities

getFormValues

Transforms the data in an HTML form element into a JavaScript object.

Params

form : An HTMLFormElement

Returns

A JavaScript object containing the form data

Examples

<form>
<input name="foo" required value="Foo" />
<input name="bar" required value="Bar" />
</form>
import { getFormValues } from '@adobe/elsie/ore/lib';
const formElement = container.querySelector('form') as HTMLFormElement;
const values = getFormValues(formElement);
console.log(values); // { bar: 'Bar', foo: 'Foo' }