util.dataforms: Small fix to allow generating forms without specifying any input data

Sat, 10 Oct 2009 03:09:15 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 10 Oct 2009 03:09:15 +0100
changeset 1945
adfd7f3720f5
parent 1944
754eebd31538
child 1946
0eb3835ef9bf

util.dataforms: Small fix to allow generating forms without specifying any input data

util/dataforms.lua file | annotate | diff | comparison | revisions
--- a/util/dataforms.lua	Sat Oct 10 02:21:25 2009 +0100
+++ b/util/dataforms.lua	Sat Oct 10 03:09:15 2009 +0100
@@ -37,7 +37,7 @@
 		-- Add field tag
 		form:tag("field", { type = field_type, var = field.name, label = field.label });
 
-		local value = data[field.name] or field.value;
+		local value = (data and data[field.name]) or field.value;
 		
 		-- Add value, depending on type
 		if field_type == "hidden" then

mercurial