diff options
-rw-r--r-- | util/dataforms.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/util/dataforms.lua b/util/dataforms.lua index 5a3b1fb5..f6a61f1f 100644 --- a/util/dataforms.lua +++ b/util/dataforms.lua @@ -67,9 +67,14 @@ function form_t.form(layout, data, formtype) form:tag("value"):text(line):up(); end elseif field_type == "list-single" then + local has_default = false; for _, val in ipairs(value) do if type(val) == "table" then form:tag("option", { label = val.label }):tag("value"):text(val.value):up():up(); + if val.default and (not has_default) then + form:tag("value"):text(val.value):up(); + has_default = true; + end else form:tag("option", { label= val }):tag("value"):text(tostring(val)):up():up(); end |