# Form >> Use Cases ||20 ```js script import { html as previewHtml } from '@mdjs/mdjs-preview'; import { Required } from '@lion/ui/form-core.js'; import { loadDefaultFeedbackMessages } from '@lion/ui/validate-messages.js'; import '@lion/ui/define/lion-fieldset.js'; import '@lion/ui/define/lion-input.js'; import '@lion/ui/define/lion-form.js'; ``` ## Submit & Reset To submit a form, use a regular ` `; }; ``` ## Prefilled data It is possible to use data to prefill the form. This can be done via the `serializedValue` attribute. ```js preview-story export const prefilledData = () => { loadDefaultFeedbackMessages(); const submitHandler = ev => { const formData = ev.target.serializedValue; console.log('formData', formData); if (!ev.target.hasFeedbackFor?.includes('error')) { fetch('/api/foo/', { method: 'POST', body: JSON.stringify(formData), }); } }; const serializedValue = { firstName: 'Foo', lastName: 'Bar', }; return html`
`; }; ``` Learn more about [formatting and parsing](../../fundamentals/systems/form/formatting-and-parsing.md). ## Sub forms To create sections inside a form you can make use of fieldsets. In some cases you want to create a reusable sub-form component. Since all form elements need to be in the light DOM, to be accessible, the sub-form needs to be in the light DOM too. To do this you'll need to make use of the `SlotMixin`. ```js preview-story import { html, LitElement } from 'lit'; import { ScopedElementsMixin } from '@open-wc/scoped-elements/lit-element.js'; import { SlotMixin } from '@lion/ui/core.js'; import { Required as _Required } from '@lion/ui/form-core.js'; import { LionFieldset } from '@lion/ui/fieldset.js'; import { LionInput } from '@lion/ui/input.js'; class SubFormAddress extends SlotMixin(ScopedElementsMixin(LitElement)) { static get scopedElements() { return { 'lion-fieldset': LionFieldset, 'lion-input': LionInput, }; } get slots() { return { ...super.slots, '': () => ({ template: this.#renderInSlot(), }), }; } render() { return html` `; } /** * @private */ #renderInSlot() { return html` `; } } customElements.define('sub-form-address', SubFormAddress); export const subForms = () => { loadDefaultFeedbackMessages(); const submitHandler = ev => { const formData = ev.target.serializedValue; console.log('formData', formData); if (!ev.target.hasFeedbackFor?.includes('error')) { fetch('/api/foo/', { method: 'POST', body: JSON.stringify(formData), }); } }; return html`
`; }; ```