Sha256: 01f23b1af0b2ece4e7a1acb256061a49e372e3983ce5d5edfffabd7ae4c8a33c
Contents?: true
Size: 762 Bytes
Versions: 8
Compression:
Stored size: 762 Bytes
Contents
# code: # * George Moschovitis <gm@navel.gr> # # (c) 2004 Navel, all rights reserved. # $Id: select.rb 99 2004-10-22 09:50:28Z gmosx $ module N; module UI class Select # Generalized select. Dont create the enclosing selects to # be flexible. # Example: # # <select name="param" onchange="submit()"> # #{N::UI::Select.render_options( # paramvalue, # [-1, 1, 2, 3], # ["-- Enter Options --", "Man", "Woman", "None"] # )} # </select> # def self.render_options(paramvalue, values, options) str = "" values.each_with_index { |val, idx| if paramvalue == val str << %{<option value="#{val}" selected="1">#{options[idx]}</option>} else str << %{<option value="#{val}">#{options[idx]}</option>} end } return str end end end; end # module
Version data entries
8 entries across 8 versions & 1 rubygems