Skip to content
This repository has been archived by the owner on Mar 25, 2022. It is now read-only.

Latest commit

 

History

History
35 lines (27 loc) · 729 Bytes

validation.md

File metadata and controls

35 lines (27 loc) · 729 Bytes

Validation

By default, XO form uses HTML5 validations

You can specify inline validation mode as follows, in the root node of the XO form schema:

{
  "validation": "inline"
}

If you want to have inline validation the default for all forms, specify it as a default at ExoFormContext creation time:

// set default validation to be 'inline' for all forms
const context = await xo.form.factory.build({
    defaults: {
        validation: "inline"
    }
});

Then, pass the context at form runtime:

let frm = await xo.form.run("/data/forms/account.json", {
    context: context,
    on: {
        post: e=>{
            // handle post
        }
    }
});