Changeset

954:72e4639c9310

util.dataforms: Fixes for hidden field type
author Matthew Wild <mwild1@gmail.com>
date Sat, 04 Apr 2009 18:07:48 +0100
parents 953:bed748f5dbb1
children 955:98ca5a753fee
files util/dataforms.lua
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/util/dataforms.lua	Sat Apr 04 16:25:16 2009 +0100
+++ b/util/dataforms.lua	Sat Apr 04 18:07:48 2009 +0100
@@ -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 @@
 		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();