Diff

util/dataforms.lua @ 4490:b672fe29184b

util.dataforms: Fix verfication for booleans
author Florian Zeitz <florob@babelmonkeys.de>
date Sat, 03 Dec 2011 17:10:48 +0100
parent 4489:e68bc6f35106
child 4884:b8d852aea3ad
line wrap: on
line diff
--- a/util/dataforms.lua	Fri Dec 02 19:24:54 2011 +0100
+++ b/util/dataforms.lua	Sat Dec 03 17:10:48 2011 +0100
@@ -252,7 +252,7 @@
 field_verifiers["boolean"] =
 	function (data, field_tag, required)
 		data = field_readers["text-single"](field_tag);
-		if #data == 0 and required then
+		if ((not data) or (#data == 0)) and required then
 			return "Required value missing";
 		end
 		if data ~= "1" and data ~= "true" and data ~= "0" and data ~= "false" then