v0.6.0
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
. Therequired
option will make sure the field value is not empty
when saving. Thevalidate
option can be used to validate the field value
using a custom function. The function should returntrue
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!' } })