Dojo NG is being built in the open, one section at a time — follow along on Heptapod.

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.

Try it in the playground

@dojo-ng/form · v0.1.2

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-submit is not emitted, and submit() returns false. Set novalidate to 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 inside dj-form for its layout.

Properties

PropertyAttributeTypeDefault
column column boolean false
noValidateSkip the validity check in submit(), like a native form's novalidate. novalidate boolean false

Events

EventDescription
dj-submit{ data }
dj-reset

Slots

Default slot

Methods

MethodDescription
submit(): booleanCheck the named controls, then emit dj-submit. Returns false when a control is invalid.
reset()