Change a record value with a select in Elm
<p>I try to do a simple thing, but it's hard to me to understand how to code.
Suppose this record</p>

<pre><code>type alias Model =
  { month : Int
  , cost : Int
  , email : String
  }
</code></pre>

<p>I have 2 ways to work with this model:
- either user changes month and it's dynamically change cost (cost = month * 10) in this example
- or user submits and it send data to a server with a json format</p>

<p>My view looks like:</p>

<pre><code>durationOption duration =
  option [value (toString duration) ] [ text (toString duration)]

view model =
  Html.div []
    [ 
    , input [ placeholder "my@email.com" ] []
    , select []
      (List.map durationOption [0..12]) -- month selector
    , Html.span [][text (toString model.total)] -- value automatically updated when users changes month value in the select
    , button [ onClick Submit ] [text "Send"]
    ] 
</code></pre>

<p>Unfortunately, i do not understand how to update values, how to just update the cost:</p>

<pre><code>update : Msg -&gt; Model -&gt; (Model, Cmd Msg)
update action model =
  case action of
    Submit -&gt;
      (model, Cmd.none)
    {-
    Calculate -&gt;
       ???? 
    -}
</code></pre>

<p>I think I have to call Calculate, but I really do not understand how to do. I ve read example from documentation but there is nothing with select ...
Can someone help me please ? </p>