     # HOOKS
     ################################################################################################
 
-    AutoForm.addHooks name,
+    hooks =
       # Settings should be passed to the autoForm helper to ensure they are available in these
       # callbacks.
       onSubmit: (insertDoc, updateDoc, currentDoc) ->
         args = arguments
         template = getTemplate(@template)
-        onSubmit = formArgs.onSubmit ? formArgs.hooks?.onSubmit
+        onSubmit = formArgs.onSubmit
         result = onSubmit?.apply(@, args)
         callback = => template.settings.onSubmit?.apply(@, args)
         deferCallback(result, callback)

        unless formArgs.loggerNotify == false || settings.loggerNotify == false
          Logger.error(error.message)
        Logger.error('Form error', operation, error, template, {notify: false})
        onError = formArgs.onError ? formArgs.hooks?.onError
        onError?.apply(@, args)
        settings.onError?.apply(@, args)


        type = Form.getTemplate().settings.formType
        # Allow passing type = null to trigger onSubmit() hook.
        if type == undefined then type = formArgs.type
        if type == undefined then type = (if doc then 'update' else 'insert')
        type
      submitText: -> if Form.getDocs().length > 0 then 'Save' else 'Create'
      hasDoc: -> Form.hasDoc()
