edit field utilities - validation
name_ = Form.prop .name (\v m -> { m | name = v })
model =
{ name = "name" |> Validate.init signature ""
}
blank = Validate.blank "blank"
view a =
{ name = a
}
Validate.compose view
( model |> ( name_ |> Validate.single [ model.name |> blank ] ) )
{-
{ hasError = True
, form =
{ name =
( "name"
, { field = model.name
, prop = name_
}
, { errors = [ "blank" ] -- model.name |> blank
}
)
}
}
-}field name, form and errors
single form model
construct Field
"name" |> Validate.init signature ""construct Single
form |> ( name_ |> Validate.single [ form.name |> Validate.blank "blank" ] )error if Nothing
error if empty string
error if empty set
error if empty list
error if string is not int
compose models
type alias Form =
{ name = Validate.Field String
}
type alias Model =
{ name = Validate.Single Form {} String
}
name_ = Form.prop .name (\v m -> { m | name = v })
Validate.compose Model
( form |> ( name_ |> Validate.single [ form.name |> Validate.blank "blank" ] ) )compose models with 2 args
Validate.compose Model
( form |> ( name_ |> Validate.single [ form.name |> Validate.blank "blank" ] ) )
( form |> ( age_ |> Validate.single [] ) )compose models with 3 args
compose models with 4 args
compose models with 5 args
compose models with 6 args
compose models with 7 args
compose models with 8 args
compose models with 9 args
compose models with 10 args
compose models with 11 args
compose models with 12 args
compose models with 13 args
compose models with 14 args
compose models with 15 args
compose models with 16 args
models and that has error