diff options
author | Kim Alvefur <zash@zash.se> | 2018-08-05 15:50:06 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-08-05 15:50:06 +0200 |
commit | 6e61be70af9faf316147876d15e160d1f9a49a06 (patch) | |
tree | ab6500efb03d437a820995c696ab9ef95f9d8ca0 /util | |
parent | 4cb9ea0f698f9d8bca8cbe9f8a48139e365885da (diff) | |
download | prosody-6e61be70af9faf316147876d15e160d1f9a49a06.tar.gz prosody-6e61be70af9faf316147876d15e160d1f9a49a06.zip |
util.dataforms: Allow passing the current values to be used in stead of omitted fields
Diffstat (limited to 'util')
-rw-r--r-- | util/dataforms.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/util/dataforms.lua b/util/dataforms.lua index a75e8db0..a5733b83 100644 --- a/util/dataforms.lua +++ b/util/dataforms.lua @@ -142,7 +142,7 @@ end 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 @@ function form_t.data(layout, stanza) 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 |