validatex v0.3.0 Validatex.Validation View Source

This module helps with validation of input forms.

Link to this section Summary

Link to this section Types

Link to this type

error_or_errors()

View Source
error_or_errors() :: error() | errors()
Link to this type

errors()

View Source
errors() :: [error()]
Link to this type

field(raw, a)

View Source
field(raw, a) :: {:field, raw, validity(a)}
Link to this type

invalid()

View Source
invalid() :: {:invalid, error_or_errors()}
Link to this type

not_validated()

View Source
not_validated() :: :not_validated
Link to this type

on_blur()

View Source
on_blur() :: :on_blur
Link to this type

on_change(val)

View Source
on_change(val) :: {:on_change, val}
Link to this type

on_submit()

View Source
on_submit() :: :on_submit
Link to this type

optional_field(raw, a)

View Source
optional_field(raw, a) :: field(raw, ExMaybe.t(a))
Link to this type

valid(a)

View Source
valid(a) :: {:valid, a}
Link to this type

validator(a, b)

View Source
validator(a, b) :: (a -> Result.t(error_or_errors(), b))
Link to this type

validity(a)

View Source
validity(a) :: not_validated() | valid(a) | invalid()

Link to this section Functions

Link to this function

apply(data, fields, f)

View Source
apply(
  %{required(key()) => field(any(), a)},
  [key()],
  (%{required(key()) => a} -> b)
) :: validity(b)
when a: var, b: var
Link to this function

extract_error(arg)

View Source
extract_error(field(any(), any())) :: ExMaybe.t(error_or_errors())
Link to this function

field(raw)

View Source
field(raw) :: {:field, raw, :not_validated} when raw: var
Link to this function

invalidate(arg, err)

View Source
invalidate(field(raw, any()), String.t()) ::
  {:field, raw, {:invalid, error_or_errors()}}
when raw: var
Link to this function

optional_field(raw)

View Source
optional_field(raw) :: {:field, raw, :not_validated} when raw: var
Link to this function

pre_validated_field(val, f)

View Source
pre_validated_field(val, (val -> String.t())) ::
  {:field, String.t(), valid(val)}
when val: var
Link to this function

raw_value(arg)

View Source
raw_value(field(raw, any())) :: raw when raw: var
Link to this function

submit_if_valid(data, fields, f)

View Source
submit_if_valid(
  %{required(key()) => field(any(), a)},
  [key()],
  (%{required(key()) => a} -> b)
) :: b
when b: Result.t(any(), any()), a: var
Link to this function

validate(field, validator, arg3)

View Source
validate(field(raw, a), validator(raw, a), event(raw)) :: field(raw, a)
Link to this function

validity(arg)

View Source
validity(field(any(), a)) :: validity(a)