8  Form Validations

(ns oiiku.ui.docs.validations)

These are the principles for form validations in Oiiku:

8.1 Form behavior

8.1.1 Submitting a form

No validation is done before the user submits the form. When submitting, the following happens:

  1. Every form field is validated
  2. Validation errors are shown:
    • Every invalid field is displayed with a red border and a red tooltip with the validation error.
    • The very first (top-to-bottom, left-to-right) invalid field is focused.
    • In tabbed forms:
      • The tab with the very first invalid field is activated.
      • Each tab label shows an indicator with the number of validation errors on that tab.
  3. The submit is prevented, and the form enters the :form/invalid state.

8.1.2 In the :form/invalid state

Again, no validation is done until the user re-submits the form.

  • When an invalid field is changed (on input), the error for that field is cleared.
  • The Save button is not disabled in this state - it’s possible to re-submit the form to re-validate it, even when invalid fields haven’t been touched.
  • When the form is re-submitted it follows the same behavior as above.
source: bases/admin-web/src/oiiku/ui/docs/validations.clj