Class: N::UI::Select

Inherits:
Object show all
Defined in:
lib/nitro/ui/select.rb

Class Method Summary collapse

Class Method Details

.render_options(paramvalue, values, options) ⇒ Object

Generalized select. Dont create the enclosing selects to be flexible. Example:

<select name=“param” onchange=“submit()”> # paramvalue, [-1, 1, 2, 3], [“– Enter Options –”, “Man”, “Woman”, “None”] ) </select>



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/nitro/ui/select.rb', line 23

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