local form = ... ?>
--[[ DEBUG INFORMATION
io.write("
DEBUGGING
DEBUG INFO: CFE
")
io.write(html.cfe_unpack(form))
io.write("")
--]]
?>
function displayinfo(myform,tags,viewonly)
io.write("\n
")
for k,v in pairs(tags) do
if (myform[v]) and (myform[v]["value"]) then
local val = myform[v]
io.write("\n\t
0) then
val.class = "error"
io.write(" class='error'")
end
io.write(">" .. val.label .. "
\n")
if (viewonly) then
io.write("\t\t
" .. val.value .. "\n")
else
io.write("\t\t
" .. html.form[val.type](val) .. "\n")
end
if (#val.errtxt > 0) then io.write("\t\t
" .. string.gsub(val.errtxt, "\n", " ") .. "
\n") end
io.write("\t\t
\n")
end
end
io.write("
")
end
?>
CONFIG
Settings
local myform = form.config
local tags = { "userid", }
displayinfo(myform,tags,"viewonly")
local tags = { "descr", }
displayinfo(myform,tags)
?>
-- The following code is a bit special because I want to display checkboxes for available roles.
local myform = form.config.roles
io.write("\n
")
io.write("\n\t
0) then
myform.class = "error"
io.write(" class='error'")
end
io.write(">" .. myform.label .. "
")
io.write("\n\t\t
")
for k,v in pairs(myform.option) do
local checked = ""
if (form.config.userid.roles[v]) then checked = "checked='yes'" end
io.write("\n\t\t\t" ..v .. ": ")
end
if (#myform.errtxt > 0) then io.write("\t\t
" .. string.gsub(myform.errtxt, "\n", " ") .. "
\n") end
io.write("\n\t\t
\n")
io.write("
")
?>
Actions
local myform = form.config
local tags = { "cmdsave", "cmddelete", }
displayinfo(myform,tags)
?>