# File lib/cgikit/elements/popup.rb, line 68
    def append_to_response( response, context )
      take_value(:list)
      take_bool(:escape)
      take_value(:default)
      take_value(:selection)
      take_value(:selected_value)
      take_bool(:enabled)
      selattrs = { :name => name_value(context), :disabled => !@values[:enabled] }
      selattrs.update(optional_attributes())
      option = value_from_request(context.request, context)
      seltag = HTMLTag.select(selattrs, other_attribute())
      optags = []

      if @values[:default] then
        attrs = { :selected => @values[:selection].nil?, :value => '' }
        optags << HTMLTag.option(attrs, '', @values[:default])
      end

      if @values[:list] then
        @values[:list].each_with_index do |item, index|
          set_value(:item, item)
          take_value(:value)
          take_value(:display)
          attrs = {}
          if (@values[:selection] == item) or \
            (option and !option.empty? and
               ((option == @values[:value].to_s) or \
                (option == index.to_s))) then
            attrs[:selected] = true
          end
          if @values[:value] then
            attrs[:value] = escaped_string(@values[:value], @values[:escape])
          else
            attrs[:value] = index
          end
          display = @values[:display] || item.to_s
          content = escaped_string(display, @values[:escape])
          optags << HTMLTag.option(attrs, '', content)
        end
      end

      ask(:popup_will_generate_tags) do |d|
        seltag, optags = d.popup_will_generate_tags(seltag, optags) || seltag, optags
      end

      response.content << seltag.open_tag
      response.content << "\n"
      optags.each do |tag|
        response.content << tag.container_tag
        response.content << "\n"
      end
      response.content << seltag.close_tag
    end