Diff

util/dataforms.lua @ 957:34f8cda285c4

util.dataforms: Allow form layouts to specify default values for fields
author Matthew Wild <mwild1@gmail.com>
date Sun, 05 Apr 2009 19:42:01 +0100
parent 956:4c3f3d60a2f4
child 1522:569d58d21612
line wrap: on
line diff
--- a/util/dataforms.lua	Sun Apr 05 19:41:24 2009 +0100
+++ b/util/dataforms.lua	Sun Apr 05 19:42:01 2009 +0100
@@ -29,7 +29,7 @@
 		-- Add field tag
 		form:tag("field", { type = field_type, var = field.name, label = field.label });
 
-		local value = data[field.name];
+		local value = data[field.name] or field.value;
 		
 		-- Add value, depending on type
 		if field_type == "hidden" then