Clinia UI

Forms and validation

How Clinia forms label fields, validate input and report errors.

How to compose a form

Example

Shown to everyone you invite.

Do put the label above and the hint below it.
Don't put the hint in the placeholder.

Grouping fields with FieldSet

Billing address

Printed on every invoice.

Do and Don't

Do mark the optional field, in words.
Don't mark required fields with an asterisk.

Do

  • Put the label above the field, in sentence case, with no colon.
  • If there is a field error, write the problem and the way out, in one sentence. It goes under the field and replaces the description, if one exists.
  • Check a field's validity when focus leaves it, and every field in the form on submit. Once a field shows an error, check it on every change, so the error clears the moment it's fixed.
  • Add "(optional)" after the label of an optional field, and leave required fields' labels unchanged.
  • Set required on every required control in the code, so screen readers announce it.
  • Label the form submit button with a verb that names the result: Create source vs Submit.
  • If a submit triggers errors, show every error and move focus to the first invalid field.
  • While the form saves, disable the submit button and switch its label to what's in progress, such as Saving. See Loading.

Don't

  • Put a hint as the field placeholder. It vanishes as soon as the user types.
  • Validate on the first keystroke.
  • Mark required fields with an asterisk.
  • Disable the submit button until the form is valid. The user can't tell what's missing.