Software / code / prosody
Comparison
util/dataforms.lua @ 9088:aa1b02411846
util.dataforms: Only include options in 'form' type forms
Options should not be needed in other types of forms.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 03 Aug 2018 21:05:48 +0200 |
| parent | 9087:9e45e7adcebf |
| child | 9089:3a7a0b9f42f3 |
comparison
equal
deleted
inserted
replaced
| 9087:9e45e7adcebf | 9088:aa1b02411846 |
|---|---|
| 48 value = data[field.name]; | 48 value = data[field.name]; |
| 49 else | 49 else |
| 50 value = field.value; | 50 value = field.value; |
| 51 end | 51 end |
| 52 | 52 |
| 53 if formtype ~= "result" and field.options then | 53 if formtype == "form" and field.options then |
| 54 local defaults = {}; | 54 local defaults = {}; |
| 55 for _, val in ipairs(field.options) do | 55 for _, val in ipairs(field.options) do |
| 56 if type(val) == "table" then | 56 if type(val) == "table" then |
| 57 form:tag("option", { label = val.label }):tag("value"):text(val.value):up():up(); | 57 form:tag("option", { label = val.label }):tag("value"):text(val.value):up():up(); |
| 58 if val.default then | 58 if val.default then |