65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/wwmd/page/form.rb', line 65
def _value
if PARSER == :nokogiri
ret = hdoc.search(".//option[@selected]").collect { |x| x.get_attribute("value") }
else
ret = hdoc.search("//option[@selected]").collect { |x| x.get_attribute("value") }
end
case ret.size
when 0
if name == "textarea"
if PARSER == :nokogiri
hdoc.text
else
hdoc.innerHTML
end
else
hdoc.get_attribute("value") if (hdoc.get_attribute("checked") || !hdoc.get_attribute("type") =~ /radio|checkbox/)
end
when 1
ret.first
else
ret
end
end
|