Skip to content

v0.6.0

Compare
Choose a tag to compare
@github-actions github-actions released this 24 Jan 13:01
· 7 commits to 15d33b2a383ba85416678afa3ca1d5d1420c2d77 since this release
  • Field validation (#369)

    Introduces two new Field options available for every Field: required and
    validate. The required option will make sure the field value is not empty
    when saving. The validate option can be used to validate the field value
    using a custom function. The function should return true if the value is
    valid, false if it is not valid and a string if it is not valid and a
    message should be shown to the user.

    alinea.text('Hello field', {
      help: 'This field only accepts "hello" as a value',
      validate(value) {
        if (value !== 'hello') return 'Only "hello" is allowed!'
      }
    })