summaryrefslogtreecommitdiffstats
path: root/lib/html.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lib/html.lua')
-rw-r--r--lib/html.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/html.lua b/lib/html.lua
index 0a23184..de69046 100644
--- a/lib/html.lua
+++ b/lib/html.lua
@@ -183,6 +183,7 @@ function form.select ( v )
reverseval[val]=x
end
end
+ local selected = false
for i, k in ipairs ( v.option ) do
local val = k
local txt = nil
@@ -194,12 +195,17 @@ function form.select ( v )
if type(v.value) == "table" then
if reverseval[val] then
str = str .. " selected"
+ selected = true
end
elseif ( v.value == val ) then
str = str .. " selected"
+ selected = true
end
str = str .. nv_pair("value", val) .. ">" .. k .. "</option>"
- end
+ end
+ if not selected then
+ str = str .. '<option selected value="' .. v.value ..'">[' .. v.value .. ']</option>'
+ end
str = str .. "</select>"
return (str)
end