Form validation.
Access the given field in the group.
field "name" stringMap over the result of the validation.
field "myfield" (string |> map String.trim)A validation that always succeeds. Useful for contextual validation.
Apply a new validation to the result of the validation.
field "myfield" (int |> andThen (minInt 10))Incremental form validation for records with more that 8 fields.
Form.Validate.succeed SomeRecord
|> andMap (field "foo" string)
|> andMap (field "bar" string)Helper to create a CustomError.
Rescue a failed validation with the supplied value.
Call Result.mapError on validation result.
Arrange that if a validation fails, it has the given custom error.
field "customerId" (V.int
|> andThen (minInt 1)
|> andThen (maxInt 9999)
|> withCustomError InvalidIdentity)Combine a list of validations into a validation producing a list of all results.
Validation a form with two fields.
Validation a form with three fields.
Validation a form with four fields.
Validation a form with five fields.
Validation a form with six fields.
Validation a form with seven fields.
Validation a form with eight fields.
Validate a list of fields.
Validation a String.
Validation an integer using String.toInt.
Validation a float using String.toFloat.
Validation a Bool.
Validation a Date using Date.fromString.
Transform validation result to Maybe, using Result.toMaybe.
Check if the string is a valid email address.
Validate an empty string, otherwise failing with InvalidString.
Useful with oneOf for optional fields with format validation.
Min value for Int.
Max value for Int.
Min value for Float.
Max value for Float.
Min length for String.
Max length for String.
Fails if String.isEmpty.
Validates format of the string.
Check if the string is included in the given list.
A validation that always fails. Useful for contextual validation.
A validation that always succeeds. Useful for contextual validation.
Custom validation for your special cases.
First successful validation wins, from left to right.
A validation is a function that takes a form field and returns a result being either a validation error or the expected object.