any validation method in object flow accepts validationMeothods options: all provided validation will be set on a created validator instance.
Key is the name of a property on data, whenever it changes on input, form state will call this validation func on validator.
The validation must at least accept value, and return a ValidationReturn. But whenever validator[validationMethod] will be called, it will also pass a model and validator itself, so they are accessible.
If you don't specify a validateDefault, all methods will be considered as default validations, and will be called on validator.validateDefault()
you can specify which methods shall be validated by default, via: validateDefault: ['nameOfSomeMethod', 'otherMethod']
providing validateDefault, does not affect the validation methods so they still accessible on validator.
This component is used for optimising rerenders, so you get the same performance as with uncontrolled components. The wrapped input will only update whenever only value, error are changed
used for chaining validations.
runs validations one by one, stops and on any that returns valid: false, otherwise goes to end and returns valid true
clones model recursively (self and all child FormModels), recreating an instances with same data as well as the validator.
instantiates a FormModel, takes it and instantiates FormState with it.
Copies recursively errors from other. Use case e.g. if you submitted, and server returned errors, so you merge in order to show them on ui.
serializes FormModel to an object.
walks modelData, if property is relation based, will call resetErrors() on them, taking into account the relation type
serializes any object to a FormData. Nested form data serialized in "hash notation", which works with most of the frameworks:
valid false if value not equals toMatch
valid false is value is undefined or empty string
valid false if length gt than specified
valid false if length lt specified
valid false if value does not match pattern
Generated using TypeDoc
arguments for "object flow", see makeFormModel makeFormStateWithModel