mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 05:37:39 +03:00
util.dataforms: Only allow overriding of options when passed via the :form method
This commit is contained in:
parent
399ddd601d
commit
4e6aa6ffd2
1 changed files with 8 additions and 9 deletions
|
@ -50,18 +50,17 @@ function form_t.form(layout, data, formtype)
|
|||
end
|
||||
end
|
||||
|
||||
local value;
|
||||
local value = field.value;
|
||||
local options = field.options;
|
||||
|
||||
if data and data[field.name] ~= nil then
|
||||
value = data[field.name];
|
||||
else
|
||||
value = field.value;
|
||||
end
|
||||
|
||||
local options = field.options;
|
||||
if formtype == "form" and value
|
||||
and (field_type == "list-single" or field_type == "list-multi") then
|
||||
-- Allow passing dynamically generated options as values
|
||||
options, value = value, nil;
|
||||
if formtype == "form" and type(value) == "table"
|
||||
and (field_type == "list-single" or field_type == "list-multi") then
|
||||
-- Allow passing dynamically generated options as values
|
||||
options, value = value, nil;
|
||||
end
|
||||
end
|
||||
|
||||
if formtype == "form" and options then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue