diff util/dataforms.lua @ 9125:da7a2db01d6a

Merge with jonasw
author Matthew Wild <mwild1@gmail.com>
date Mon, 06 Aug 2018 08:21:55 +0100
parents e5eb36ee07a2
children 68694c1bd960
line wrap: on
line diff
--- a/util/dataforms.lua	Sun Aug 05 11:44:49 2018 +0200
+++ b/util/dataforms.lua	Mon Aug 06 08:21:55 2018 +0100
@@ -142,7 +142,7 @@
 
 local field_readers = {};
 
-function form_t.data(layout, stanza)
+function form_t.data(layout, stanza, current)
 	local data = {};
 	local errors = {};
 	local present = {};
@@ -157,7 +157,9 @@
 		end
 
 		if not tag then
-			if field.required then
+			if current and current[field.name] ~= nil then
+				data[field.name] = current[field.name];
+			elseif field.required then
 				errors[field.name] = "Required value missing";
 			end
 		elseif field.name then