summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-06-05 14:06:22 +0000
committerTed Trask <ttrask01@yahoo.com>2008-06-05 14:06:22 +0000
commitc8dea72c8ba7d35273417482dc59070a9de9b9ff (patch)
tree8d766700b282b2d0d4be01dc48cd9bcdb81a3fe8 /lib
parent7bc745d79d2013e2610d1b802c4a12cbc7748a86 (diff)
downloadacf-core-c8dea72c8ba7d35273417482dc59070a9de9b9ff.tar.bz2
acf-core-c8dea72c8ba7d35273417482dc59070a9de9b9ff.tar.xz
Updated lbu to use new cfe model and components
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1197 ab2d0c66-481e-0410-8bed-d214d4d58bed
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")