Software /
code /
verse
Comparison
util/dataforms.lua @ 442:b2ae91f4fec9
util.dataforms: Support XEP-0122 validation
On par with what can be generated, for symetry.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 23 Nov 2020 23:49:42 +0100 |
parent | 441:e4c0b1d7fd6b |
child | 490:6b2f31da9610 |
comparison
equal
deleted
inserted
replaced
441:e4c0b1d7fd6b | 442:b2ae91f4fec9 |
---|---|
60 else | 60 else |
61 field.value = value; | 61 field.value = value; |
62 end | 62 end |
63 end | 63 end |
64 end | 64 end |
65 local datatype_tag = tag:get_child("validate", xmlns_validate); | |
66 if datatype_tag then | |
67 field.datatype = datatype.attr.datatype; | |
68 local range_tag = datatype_tag:get_child("range"); | |
69 if range_tag then | |
70 field.range_min = tonumber(range_tag.attr.min); | |
71 field.range_max = tonumber(range_tag.attr.max); | |
72 end | |
73 end | |
74 | |
65 end | 75 end |
66 return new(layout); | 76 return new(layout); |
67 end | 77 end |
68 | 78 |
69 function form_t.form(layout, data, formtype) | 79 function form_t.form(layout, data, formtype) |