There are several components and mixins available to help make working with forms easier.
These two components behave much like a native <form>
element, grouping nested form elements together and controlling how their data is validated and submitted. Unlike native <form>
s, they support our custom form elements.
- d2l-form: supports aggregation of nested forms for validation and submission
- d2l-form-native: emulates how a native
<form>
submits, but supports our custom form elements
To allow custom elements to participate in <d2l-form>
and <d2l-form-native>
submission and validation, use the FormElementMixin.
If your custom element uses other nested custom form elements internally, read about form element nesting.
On the other hand, if your custom element uses other nested native form elements internally, read about form element wrapping.