This module contains a value type for your form fields.
A blank value.
Use this to initialize the values of your empty fields:
values : SignupValues
values =
{ email = Value.blank
, password = Value.blank
, rememberMe = Value.blank
}Build an already filled value.
Use this when you are using forms to edit existing values:
values : Profile -> ProfileValues
values profile =
{ firstName = Value.filled profile.firstName
, lastName = Value.filled profile.lastName
}Obtain the data inside a Value.
If the value is blank, it returns Nothing, else it returns Just the value.
Note: You should only be using this in meta forms or
custom view code.
Update a value with new data.
Note: You should not need to care about this unless you are creating your own custom fields.
Select the newest value out of two sets of values.
This is necessary to fix an issue with autocompletion. When a form is autocompleted, many events can get triggered before the view can be rerendered, causing the first autocompleted values to be lost.
newest allows to fix this:
update : Msg -> Model -> Model
update msg values =
FormChanged newForm ->
{ form |
values =
{ email = Value.newest .email form.values newForm.values
, password = Value.newest .password form.values newForm.values
}
}Note: This issue seems fixed in Elm 0.19, thus this function will be removed soon.
Represents a form field value.