bkuhlmann/form-validator/1.1.0

NOTE: this package is not compatible with Elm 0.19.1

FormValidator.Models

Form Validator component models.

type alias Form key =
List (Field key)

The form model which stores a list of fields for input and validation.

type alias Field key =
{ key : key
, value : String
, validators : Validators
, errors : Errors
}

The form field, identified by unique key, which stores a value, validators of that value, and validation errors (if any).

type alias Validators =
List Validator

Convenience model for list of validators.

type alias Validator =
String -> Maybe String

Validates value as either an error string (invalid) or nothing at all (valid).

type alias Values =
List Value

A list of values to be validated.

type alias Value =
String

A value to be validated.

type alias Errors =
List Error

The error messages of invalid values.

type alias Error =
Maybe String

The error message of an invalid value.