aboutsummaryrefslogtreecommitdiff
path: root/src/client/View/Events.elm
blob: 1eb90273e4c8fe62228522fbea9d471b716144d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module View.Events
  ( onSubmitPrevDefault
  ) where

import Signal
import Json.Decode as Json
import Html exposing (..)
import Html.Events exposing (..)
import Html.Attributes exposing (..)

onSubmitPrevDefault : Signal.Address a -> a -> Attribute
onSubmitPrevDefault address value =
  onWithOptions
    "submit"
    { defaultOptions | preventDefault <- True }
    Json.value
    (\_ ->
      Signal.message address value
    )