 
     if @target.required
       input_attrs.required = @target.required
+      input_attrs["data-required"] = @target.required
       @target.required = false
 
     @$container = $("<div />", container_props)

      @disabled = true
      @enable()

  invalid: (evt, data) ->
    return not @parser.selected().length

  reset: ->
    @deselect_all()


    if @target.id.length
      $("label[for=#{@target.id}]").unbind "click"

    @$target.unbind "change", @change

    @$dropdown.unbind()
    @$container.$search.unbind()
    @$container.unbind()

    return true

  change: (evt) ->
    if @parser.selected().length
      @$container.$search.removeAttr("required")
    else if @$container.$search.data("required")
      @$container.$search.attr("required", "required")

  activate: ->
    @$container.$search.trigger("focus")
