def append_to_response( response, context )
take_value(:list)
take_bool(:escape)
take_value(:default)
take_value(:selection)
take_value(:selected_value)
option = value_from_request(context.request, context)
html = "<select name=\"#{name_value(context)}\""
html << other()
html << enabled()
html << ">\n"
if @values[:default] then
html << '<option value=""'
if @values[:selection].nil? then
html << selected()
end
html << ">#{@values[:default]}</option>\n"
end
if @values[:list] then
@values[:list].each_with_index do |item, index|
set_value(:item, item)
take_value(:value)
take_value(:display)
html << "<option"
if (@values[:selection] == item) or \
(option and !option.empty? and
((option == @values[:value].to_s) or \
(option == index.to_s))) then
html << selected()
end
if @values[:value] then
value = escaped_string(@values[:value], @values[:escape])
html << " value=\"#{value}\""
else
html << " value=\"#{index}\""
end
html << ">"
unless display = @values[:display] then
display = item.to_s
end
display = escaped_string(display, @values[:escape])
html << "#{display}</option>\n"
end
end
html << '</select>'
response.content << html
end