   # -------------------------------------
 
   _setEventHandlers = ->
-    _settings.elements.each ->
+    _settings.element.on 'input', ->
       element = $(@)
+      key = element.data(_settings.dataAttribute)
+      value = element.val()
 
-      element.on 'input', ->
-        key = element.data(_settings.dataAttribute)
-        value = element.val()
+      _storeProgress( key, value )
 
-        _storeProgress( key, value )
+    _settings.container.on 'submit', (event) ->
+      _eraseProgress($(@))
 
   # -------------------------------------
   #   Store Progress

    _setEventHandlers()

  # -------------------------------------
  #   Restore Progress
  # -------------------------------------

  _restoreProgress = ->
    _settings.elements.each ->
      element = $(@)
      key = element.data(_settings.dataAttribute)
      value = localStorage.getItem key

      element.val(value)



  init = (options) ->
    _settings = $.extend(
      element: $('.js-saveProgress')
      container: $('.js-saveProgress-container')
      dataAttribute: 'saveprogress'
    , options)

