def append_to_response( response, context )
take_value(:list)
take_value(:selections)
take_value(:selected_values)
take_bool(:escape)
take_bool(:multiple)
options = values_from_request(context.request, context)
html = "<select name=\"#{name_value(context)}\""
if @values[:multiple] then html << ' multiple="multiple"' end
html << other()
html << enabled()
html << ">\n"
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[:selections] and @values[:selections].include?(item)) or \
(options and
(options.include?(@values[:value].to_s) or \
options.include?(index.to_s))) then
html << " selected=\"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