aboutsummaryrefslogtreecommitdiffstats
path: root/util/dataforms.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-04-04 18:07:48 +0100
committerMatthew Wild <mwild1@gmail.com>2009-04-04 18:07:48 +0100
commitdd4c9e6eece3c29c902d818eda9c0a87534b3147 (patch)
tree39f948853fd0ac22e1ed8872add2cffa35987e12 /util/dataforms.lua
parent4af9474ef298c133cf87d67124a65d5f06edd881 (diff)
downloadprosody-dd4c9e6eece3c29c902d818eda9c0a87534b3147.tar.gz
prosody-dd4c9e6eece3c29c902d818eda9c0a87534b3147.zip
util.dataforms: Fixes for hidden field type
Diffstat (limited to 'util/dataforms.lua')
-rw-r--r--util/dataforms.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/util/dataforms.lua b/util/dataforms.lua
index 26ed8bda..3c979bcc 100644
--- a/util/dataforms.lua
+++ b/util/dataforms.lua
@@ -1,5 +1,8 @@
local setmetatable = setmetatable;
local pairs, ipairs = pairs, ipairs;
+local tostring, type = tostring, type;
+local t_concat = table.concat;
+
local st = require "util.stanza";
module "dataforms"
@@ -34,9 +37,11 @@ function form_t.form(layout, data)
if field_type == "hidden" then
if type(value) == "table" then
-- Assume an XML snippet
- form:add_child(value);
+ form:tag("value")
+ :add_child(value)
+ :up();
elseif value then
- form:tag("value"):text(tostring(value));
+ form:tag("value"):text(tostring(value)):up();
end
elseif field_type == "boolean" then
form:tag("value"):text((value and "1") or "0"):up();