         @$('#focus_new_name').focus()
 
 
-    on_submit: ->
+    on_submit: =>
         super
         @old_name = @model.get('name')
         @formdata = util.form_data_as_object($('form', @$modal))


        # Check if already use
        if no_error is true
            if @model instanceof models.Table
                query = r.db(system_db).table('table_config').get(@model.get('id')).update
                    name: @formdata.new_name
            else if @model instanceof model.Database
                query = r.db(system_db).table('db_config').get(@model.get('id')).update
                    name: @formdata.new_name
            else if @model instanceof model.Server
                query = r.db(system_db).table('server_config').get(@model.get('id')).update
                    name: @formdata.new_name


    error_template: require('../../handlebars/error_input.hbs')
    class: 'rename-item-modal'

    initialize: (options) =>
        super
        if @model instanceof models.Table
            @item_type = 'table'
        else if @model instanceof models.Database
            @item_type = 'database'
        else if @model instanceof models.Server
            @item_type = 'server'
        else if options.item_type?
            @item_type = options.item_type
        else
            throw "Rename *what* kind of item?"

    render: ->
        super
