21 |
21 |
22 function new(layout) |
22 function new(layout) |
23 return setmetatable(layout, form_mt); |
23 return setmetatable(layout, form_mt); |
24 end |
24 end |
25 |
25 |
26 function form_t.form(layout, data) |
26 function form_t.form(layout, data, formtype) |
27 local form = st.stanza("x", { xmlns = xmlns_forms, type = "form" }); |
27 local form = st.stanza("x", { xmlns = xmlns_forms, type = formtype or "form" }); |
28 if layout.title then |
28 if layout.title then |
29 form:tag("title"):text(layout.title):up(); |
29 form:tag("title"):text(layout.title):up(); |
30 end |
30 end |
31 if layout.instructions then |
31 if layout.instructions then |
32 form:tag("instructions"):text(layout.instructions):up(); |
32 form:tag("instructions"):text(layout.instructions):up(); |