   enterNewValue = (selectedValue, target) ->
     inputField = getInputField(target)
     currentValues = getCurrentValues(target)
+
+    if !!target.data('max') && currentValues.length >= target.data('max')
+      shiftedValue = currentValues.shift()
+      wrapper = getWrapperField(target)
+      wrapper.find('.token').first().remove()
+
     currentValues.push(selectedValue)
     inputField.val(JSON.stringify(currentValues))
 

        selectedValue = e.attrs.value
        removeExistingValue(selectedValue, $this)
      .on 'tokenfield:createtoken', (e) ->
      if e.attrs.value is e.attrs.label
        false

      tokens = retrieveExistingTokens(data, $this)
      $this.tokenfield('setTokens', tokens);


  getCurrentValues = (target) ->
    inputField = getInputField(target)
    currentValues = if !!inputField.val() then JSON.parse(inputField.val()) else []

  getInputField = (target) ->
    getWrapperField(target).next()
