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
    )