summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/html.lua8
-rw-r--r--lib/viewfunctions.lua2
2 files changed, 8 insertions, 2 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
diff --git a/lib/viewfunctions.lua b/lib/viewfunctions.lua
index 3460764..312ba3b 100644
--- a/lib/viewfunctions.lua
+++ b/lib/viewfunctions.lua
@@ -93,7 +93,7 @@ function displayitem(myitem)
end
io.write(">" .. myitem.label .. "</DT>\n")
io.write("<DD>")
- io.write(string.gsub(myitem.value, "\n", "<BR>") .. "\n")
+ io.write(string.gsub(tostring(myitem.value), "\n", "<BR>") .. "\n")
if myitem.descr then io.write("<P CLASS='descr'>" .. string.gsub(myitem.descr, "\n", "<BR>") .. "</P>\n") end
if myitem.errtxt then io.write("<P CLASS='error'>" .. string.gsub(myitem.errtxt, "\n", "<BR>") .. "</P>\n") end
io.write("</DD>\n")