import { Story, Meta, html } from '@open-wc/demoing-storybook'; import { Required, MaxLength, loadDefaultFeedbackMessages } from '@lion/validate'; import '@lion/fieldset/lion-fieldset.js'; import '@lion/input/lion-input.js'; import '../lion-form.js'; import './helpers/demo-form-child.js'; # Form `lion-form` is a webcomponent that enhances the functionality of the native `form` component. It is designed to interact with (instances of) the [form controls](?path=/docs/forms-system-overview). {html`
`}
```html
``` ## Features - Data synchronization with models - Easy retrieval of form data based on field names - Advanced validation possibilities - Advanced user interaction scenarios via [interaction states](?path=/docs/forms-system-interaction-states) - Registration mechanism for [form controls](?path=/docs/forms-system-overview) - Accessible out of the box For more information about fields that are designed for lion-form, please read [Forms](?path=/docs/forms-form). ## Form Submit / Reset You can control whether a form gets submitted based on validation states. Same thing goes for resetting the inputs to the original state. {() => { loadDefaultFeedbackMessages(); const submit = () => { const form = document.querySelector('#form2'); if (!form.hasFeedbackFor.includes('error')) { console.log(form.serializeGroup()); form.resetGroup(); } }; return html`

A reset button should never be offered to users. This button is only used here to demonstrate the functionality.

`; }}
```js import { Required, MaxLength } from '@lion/validate' const submit = () => { const form = document.querySelector('#form2'); if (!form.hasFeedbackFor.includes('error')) { console.log(form.serializeGroup()); form.resetGroup(); } }; ``` ```html

A reset button should never be offered to users. This button is only used here to demonstrate the functionality.

```