summaryrefslogtreecommitdiffstats
path: root/lib/html.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-04-30 20:36:02 +0000
committerTed Trask <ttrask01@yahoo.com>2008-04-30 20:36:02 +0000
commit378e53f20a0f11c36afffbaef78f47a5303df9ce (patch)
treea39e3c216dc10f919ef272c53b67a8f01f001be0 /lib/html.lua
parent82fd96bdcc5b721d8fc208fe4edba54f4dc6fdb7 (diff)
downloadacf-core-378e53f20a0f11c36afffbaef78f47a5303df9ce.tar.bz2
acf-core-378e53f20a0f11c36afffbaef78f47a5303df9ce.tar.xz
Modified cfe, removing option, errtxt, and name, and adding label - This may break things.
Rewrote password module, adding model Modified authenticator to make password module work git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1052 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/html.lua')
-rw-r--r--lib/html.lua22
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/html.lua b/lib/html.lua
index 136ce2b..0a23184 100644
--- a/lib/html.lua
+++ b/lib/html.lua
@@ -92,7 +92,7 @@ local generic_input = function ( field_type, v )
for i,k in ipairs ( {
"name", "size", "checked", "maxlength",
"value", "length", "class", "id", "src",
- "align", "alt",
+ "align", "alt", "contenteditable",
"tabindex", "accesskey", "onfocus", "onblur"
} ) do
str = str .. nv_pair ( k, v[k] )
@@ -129,7 +129,7 @@ form.longtext = function ( v )
end
-function form.passwd ( v )
+function form.password ( v )
return generic_input ( "password", v )
end
@@ -156,7 +156,7 @@ function form.image ( v )
end
--- v.value is the selected item
+-- v.value is the selected item (or an array if multiple)
-- v.option is an array of valid options
-- NOTE use of value and values (plural)
function form.select ( v )
@@ -177,6 +177,12 @@ function form.select ( v )
end
str = str .. ">"
-- now the options
+ local reverseval = {}
+ if type(v.value) == "table" then
+ for x,val in ipairs(v.value) do
+ reverseval[val]=x
+ end
+ end
for i, k in ipairs ( v.option ) do
local val = k
local txt = nil
@@ -184,9 +190,13 @@ function form.select ( v )
txt=val[1]
val=val[0]
end
- str = str .. "<option "
- if ( v.value == val ) then
- str = str .. " selected "
+ str = str .. "<option "
+ if type(v.value) == "table" then
+ if reverseval[val] then
+ str = str .. " selected"
+ end
+ elseif ( v.value == val ) then
+ str = str .. " selected"
end
str = str .. nv_pair("value", val) .. ">" .. k .. "</option>"
end