This library provides a datatype to model and validate input field data.
For an example, take a look at the README
A type to reperesent various bits of data about any individiual field. You can get this record
from a field with extractMetadata, and set this record with resetMetadata
A mapping from different field statuses to Html
Takes a ViewConfig and a field and uses the different possible Html based on the field's status
Reset a field with a new value, and set it to the valid status
Extract the metadata from a field, regardless of the field's status
Reset a field with new metadata
Extract the value from a field, regardless of the field's status
Return the value of a field if it is in a valid status, otherwise get the default value provided
Returns true if the field in currently in a valid state, false otherwise
Returns true if the field in currently in a invalid state, false otherwise
Type alias that takes a field, and returns a field
Alias to createValidator. Deprecated.
Create a validator by testing a field against the provided function. If the field passes then return the field the exact same, otherwise return a field marked as invalid with the provided error. If the field is already invalid, then this function just returns the field as it got it. This is to keep the exisitng error, so you can chain together validation functions easily.
Look to the Field.String, Field.Int and Field.Float modules in this package. for pre-created validation functions.
The field type, it represents all the possible state that a field can be in. It has take parameters of an error type and a value type.
Unless you're trying to model some unique data you probably won't be using this type, but one with the
valueanderrorarguements already applied. Take a look at theField.String,Field.IntandField.Floatmodules to see some common types already appplied and for examples to modeling your own data.