       onSuccess: (operation, result) ->
         args = arguments
         template = getTemplate(@template)
-        console.debug 'onSuccess', args, @
-        AutoForm.resetForm(name)
+        Form.updateDocs(template)
+        Form.setUpDocs(template)
         onSuccess = formArgs.onSuccess ? formArgs.hooks?.onSuccess
         result = onSuccess?.apply(@, args)
         callback = => template.settings.onSuccess?.apply(@, args)
         deferCallback(result, callback)
+
+      before:
+        # Remove fields in the modifiers which haven't been changed.
+        update: (modifier) ->
+          $input = $(@autoSaveChangedElement)
+          changes = Form.getDocChanges(@template)
+          _.each ['$set', '$unset'], (propName) ->
+            fields = modifier[propName]
+            if fields?
+              _.each fields, (value, key) ->
+                unless changes[key]? then delete fields[key]
+          modifier
 
       onError: (operation, error) ->
         template = getTemplate(@template)

    # AUXILIARY
    ################################################################################################

    Form.parseDocs = (template) ->
      template = getTemplate(template)
      data = template.data


    Form.created = ->
      @settings = @data.settings ? {}
      Form.setUpDocs(@)
      @isSubmitting = false
      formArgs.onCreate?.apply(@, arguments)

    Form.rendered = ->
      # Move the buttons to the same level as the title and content to allow using flex-layout.
      $buttons = @$('.crud.buttons')
      $crudForm = @$('.flex-panel:first')
