util.dataforms: Fix parsing of -multi fields

This commit is contained in:
Florian Zeitz 2012-06-12 18:29:58 +02:00
parent f76c2aa90b
commit 49d3586dc1

View file

@ -185,7 +185,7 @@ field_readers["list-multi"] =
function (field_tag, required) function (field_tag, required)
local result = {}; local result = {};
for value in field_tag:childtags("value") do for value in field_tag:childtags("value") do
result[#result+1] = value; result[#result+1] = value:get_text();
end end
return result, (required and #result == 0 and "Required value missing" or nil); return result, (required and #result == 0 and "Required value missing" or nil);
end end
@ -202,10 +202,10 @@ field_readers["text-multi"] =
field_readers["list-single"] = field_readers["list-single"] =
field_readers["text-single"]; field_readers["text-single"];
local boolean_values = { local boolean_values = {
["1"] = true, ["true"] = true, ["1"] = true, ["true"] = true,
["0"] = false, ["false"] = false, ["0"] = false, ["false"] = false,
}; };
field_readers["boolean"] = field_readers["boolean"] =
function (field_tag, required) function (field_tag, required)