Comparison

util/dataforms.lua @ 953:bed748f5dbb1

util.dataforms: Fix some field types which didn't render properly
author Matthew Wild <mwild1@gmail.com>
date Sat, 04 Apr 2009 16:25:16 +0100
parent 952:ef648f49e734
child 954:72e4639c9310
comparison
equal deleted inserted replaced
952:ef648f49e734 953:bed748f5dbb1
34 if field_type == "hidden" then 34 if field_type == "hidden" then
35 if type(value) == "table" then 35 if type(value) == "table" then
36 -- Assume an XML snippet 36 -- Assume an XML snippet
37 form:add_child(value); 37 form:add_child(value);
38 elseif value then 38 elseif value then
39 form:text(tostring(value)); 39 form:tag("value"):text(tostring(value));
40 end 40 end
41 elseif field_type == "boolean" then 41 elseif field_type == "boolean" then
42 form:tag("value"):text((value and "1") or "0"); 42 form:tag("value"):text((value and "1") or "0"):up();
43 elseif field_type == "fixed" then 43 elseif field_type == "fixed" then
44 44
45 elseif field_type == "jid-multi" then 45 elseif field_type == "jid-multi" then
46 for _, jid in ipairs(value) do 46 for _, jid in ipairs(value) do
47 form:tag("value"):text(jid):up(); 47 form:tag("value"):text(jid):up();