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/lion-form.js'; # Form Examples A form can have multiple nested fieldsets. {html`
`}
```html
``` ## 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.

```