Comparison

util/dataforms.lua @ 8945:cbeb1a045eb6

util.dataforms: Add support for field descriptions in <desc>
author Kim Alvefur <zash@zash.se>
date Wed, 27 Jun 2018 20:06:13 +0200
parent 8864:cf2f66b233d1
child 8984:fa80b3231a02
comparison
equal deleted inserted replaced
8944:200ec7d38a0e 8945:cbeb1a045eb6
35 end 35 end
36 for _, field in ipairs(layout) do 36 for _, field in ipairs(layout) do
37 local field_type = field.type or "text-single"; 37 local field_type = field.type or "text-single";
38 -- Add field tag 38 -- Add field tag
39 form:tag("field", { type = field_type, var = field.name, label = field.label }); 39 form:tag("field", { type = field_type, var = field.name, label = field.label });
40
41 if field.desc then
42 form:text_tag("desc", field.desc);
43 end
40 44
41 local value = (data and data[field.name]) or field.value; 45 local value = (data and data[field.name]) or field.value;
42 46
43 if value then 47 if value then
44 -- Add value, depending on type 48 -- Add value, depending on type