 class CoffeeMiddleware.Component.JsonForm extends CoffeeMiddleware.System.Base
   constructor: (@container, @autoAction = true) ->
     super(@container)
+    @containerIsForm = false
     if @container.is 'form'
       @form = @container
+      @containerIsForm = true
     else
       @form = ($ 'form', @container)
 

  updateForm: (event, json) =>
    if @autoAction
      @form = $(json.template).replaceAll(@form)
      @initForm()
    @form.trigger('jsonForm:updated')

  cancelForm:  =>
    @container.remove()

          window.top.location = json.redirect
      else if json.template
        @form = $(json.template).replaceAll(@form)
        if @containerIsForm
          @container = @form
          @reBind()
        @initForm()
        @form.trigger('jsonForm:completed')
    else
