ozmat/elm-forms/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

Forms.Value

A Value represents the value inside a Field. Please refer to the examples for a better understanding

Definition

type Value
= String String
| Bool Bool

A Value can be a String (form input) or a Bool (form checkbox)

String "some input value"


Bool True

Common Helpers

string : String -> Value

Helps creating a String Value

string "some input value" -- String "some input value"
bool : Bool -> Value

Helps creating a Bool Value

bool True -- Bool True

Is the default String Value (empty string)

String ""
defaultBool : Value

Is the default Bool Value (false)

Bool False

Update

safeUpdate : Value -> Value -> Value

Only updates Values of same type

safeUpdate (String "new one") (String "old one") -- String "new one"
safeUpdate (String "new one") (Bool False)       -- Bool False