Olddevs UI4.14.0
Recipes

The Editor in a form

FormField, a name for FormData, your own required check and focus on the field with an error.

The Editor is a form field like TextControl: label, hint and error come from FormField, the value goes into FormData under name.

What happened and what you expected.

Try it

Press “Create ticket” with an empty description — an error appears and focus moves into the Editor. Write some text and submit again: below you'll see what went into FormData.

How it works

The field's name comes from the FormField label

contenteditable doesn't pair with <label for>, so FormField publishes its label id and the Editor points at it with aria-labelledby. A click on the label focuses the Document. No aria-label needed here.

Hint and error

The hint and the error go into aria-describedby; the error sets aria-invalid and colors the frame.

The value in the form

The Editor puts the Document's HTML into a hidden field with name.

Required state

The kit's Form is noValidate, so checking is the screen's job: isEmpty() decides by the kit's rule (an Atom, an image and a table count as content, even with empty cells; an empty paragraph doesn't). In a plain <form> the required prop blocks sending an empty Document by itself, like a native field.

On this page