Input.import Html
import Prima.Pyxis.Form.Flag as Flag
import Prima.Pyxis.Form.Validation as Validation
...
type Msg =
OnCheck Bool
type alias Model =
{ privacy: Maybe Bool }
...
view : Html Msg
view =
Html.div
[]
(Flag.flag .privacy OnInput
|> Input.withValidation (Maybe.andThen validate << .privacy)
)
validate : Maybe Bool -> Validation.Type
validate privacy=
if isJust privacy then
Just <| Validation.ErrorWithMessage "Privacy cannot be blank".
else
NothingAdds a generic Html.Attribute to the Input.
Sets a disabled to the Flag config.
Attaches the onBlur event to the Flag.
Attaches the onFocus event to the Flag.
Adds a Validation rule to the Flag.
Represent the opaque
Flagconfiguration.