                 $el.find(".new-value input:visible").first().focus()
 
         saveValue = (target) ->
-            form = target.parents("form").checksley()
+            formEl = target.parents("form")
+            form = formEl.checksley()
             return if not form.validate()
 
-            value = target.scope().value
+            value = formEl.scope().value
             promise = $repo.save(value)
             promise.then =>
                 row = target.parents(".row.table-main")

        $el.on "click", ".delete-value", (event) ->
            event.preventDefault()
            target = angular.element(event.currentTarget)
            value = target.scope().value
            choices = {}
            _.each $scope.values, (option) ->
                if value.id != option.id


        cancel = (target) ->
            row = target.parents(".row.table-main")
            formEl = target.parents("form")
            value = formEl.scope().value
            $scope.$apply ->
                row.addClass("hidden")
                value.revert()
