API REFERENCE · FORM CONTROLS
<dj-form>
A layout wrapper that gathers values from its named child controls and emits dj-submit with a { name: value } object. column stacks fields.
npm install @dojo-ng/form
import "@dojo-ng/form";
Submitting
submit()checks every named control first. When one is invalid, the browser shows its message on the first invalid control,dj-submitis not emitted, andsubmit()returns false. Setnovalidateto skip the check.- Values follow the rules of a native form: a checkbox or switch counts only when it is checked, disabled controls are left out, and a name used by several checked controls gives an array.
- Enter in a field submits, except in a text area or other multi-line editor, where Enter adds a new line.
A native form instead
- The controls are form-associated, so they also work in a native
<form>, which adds posting to a URL,FormData, and reset buttons. A native form can sit insidedj-formfor its layout.
Properties
| Property | Attribute | Type | Default |
|---|---|---|---|
column |
column |
boolean |
false |
noValidateSkip the validity check in submit(), like a native form's novalidate. |
novalidate |
boolean |
false |
Events
| Event | Description |
|---|---|
dj-submit | { data } |
dj-reset |
Slots
Default slot
Methods
| Method | Description |
|---|---|
submit(): boolean | Check the named controls, then emit dj-submit. Returns false when a control is invalid. |
reset() |