Kim Alvefur
7cafc69278
util.dataforms: Add support for validating (integer) ranges
6 years ago
Kim Alvefur
5b16babafb
util.dataforms: Convert media element sizes to avoid error on Lua 5.3
...
The stanza API does not accept number values and threw an error due to
the height and width attributes of the media element (XEP-0221).
This part had no test coverage previously, explaining why it was not
discovered until now.
5 years ago
Kim Alvefur
f77cf987ce
util.dataforms: Improve default error message for failed datatype validation
7 years ago
Kim Alvefur
080c294fe8
util.dataforms: Add support for XEP-0122: Data Forms Validation
...
Initially only basic validation of xs:integer
7 years ago
Kim Alvefur
367e73a610
util.dataforms: Allow field names to be different from the 'var' attribute
...
This should allow the usage of long prefixes and namespace-like names to
be contained to the XML representation of the form, so that the code can
use more convenient names.
7 years ago
Matthew Wild
87b9555f23
util.dataforms: Don't include list options in result forms ( fixes #983 )
8 years ago
Kim Alvefur
6e61be70af
util.dataforms: Allow passing the current values to be used in stead of omitted fields
8 years ago
Kim Alvefur
da42eb7404
util.dataforms: Normalize indentation
8 years ago
Kim Alvefur
1601e8c4d2
util.dataforms: Only allow overriding of options when passed via the :form method
8 years ago
Kim Alvefur
d407be54b1
util.dataforms: Allow overriding default options even if the form has such
8 years ago
Kim Alvefur
67ab854aac
util.dataforms: Allow passing dynamically generated options as values (fixes traceback)
...
This is awkward but there?s currently no better way to do this, short of
dynamically generating the entire form each time
8 years ago
Kim Alvefur
724934bdc5
util.dataforms: Exclude descriptive text fields from forms of type 'submit'
...
The receiving end presumably already have the original form, so these
potentially long text fields are of little value.
8 years ago
Kim Alvefur
832484e723
util.dataforms: Skip all fields for the 'cancel' form type
...
XEP-0004 says:
> a data form of type "cancel" SHOULD NOT contain any <field/> elements.
The title and instructions don't seem to be of much value in this case
either.
I'm not aware of 'cancel' being used anywhere, so this should break
nothing. Early return is always nice.
8 years ago
Kim Alvefur
154e32c79d
util.dataforms: Only include options in 'form' type forms
...
Options should not be needed in other types of forms.
8 years ago
Kim Alvefur
b5f0ad00c6
util.dataforms: Set default value for form type argument
8 years ago
Kim Alvefur
8de8df075d
util.dataforms: Detach generation of options from values ( fixes #1177 )
8 years ago
Kim Alvefur
747b34d54a
util.dataforms: Ensure fields have names when collecting data (fixes traceback, thanks Martin)
8 years ago
Matthew Wild
554651a23b
util.dataforms: More robust handling of field values, especially booleans
...
Ensure that a non-nil data[field_name] always overrides the field's default,
and that values of boolean 'false' are always rendered in the form.
8 years ago
Kim Alvefur
8714ac8f2a
util.dataforms: Add support for field descriptions in <desc>
8 years ago
Kim Alvefur
7bc9f73c73
util.dataforms: Add a simple function for identifying form types
...
This is meant to allow identifying forms without parsing them
completely.
8 years ago
Kim Alvefur
dd0d9009e8
util.dataforms: Remove string conversion to let util.stanza validate types
8 years ago
Kim Alvefur
146acdbd33
vairious: Add annotation when an empty environment is set [luacheck]
8 years ago
Kim Alvefur
45079c02ef
util.dataforms: Fix including default value for list-single when given as field.value[].default
10 years ago
Kim Alvefur
c6db698f65
util.dataforms: Allow separation of options from values in list fields
10 years ago
Kim Alvefur
76cc2a0c00
util.dataforms: Track which fields are included in a form
10 years ago
Kim Alvefur
11f10d8b31
util.dataforms: Fix interaction of required fields and empty string values ( fixes #521 )
10 years ago
Kim Alvefur
8e89a3e5e7
util.dataforms: Refactor parsing to reuse simple text parser instead of duplicate code
10 years ago
Matthew Wild
31bbce98bd
util.dataforms: Rename unused loop counter to '_' [luacheck]
11 years ago
Matthew Wild
526f5c061e
util.dataforms: Remove unused import of pairs() (thanks luacheck)
11 years ago
Kim Alvefur
3015aac8bc
util.*: Remove use of module() function, make all module functions local and return them in a table at the end
11 years ago
daurnimator
997400f63d
util/dataforms: Make sure we iterate over field tags
11 years ago
Kim Alvefur
e02bb3f307
util.dataforms: Add support for XEP-0221: Data Forms Media Element
12 years ago
Florian Zeitz
4b618a8727
Remove all trailing whitespace
13 years ago
Florian Zeitz
7aae7dc1a3
util.dataforms: Return nil for empty list-mutli responses, to be consistent with other readers
13 years ago
Florian Zeitz
2344ef5437
util.dataforms: Add support for generating type='fixed' fields
13 years ago
Florian Zeitz
e75bdcefee
util.dataforms: Fix parsing of -multi fields
14 years ago
Kim Alvefur
e2ff625068
util.dataforms: Don't return invalid JIDs in jid-single.
14 years ago
Kim Alvefur
92447edf0c
util.dataforms: Fix validation of booleans.
14 years ago
Kim Alvefur
a4cc21bca1
util.dataforms: Do field validation and normalization in field readers.
14 years ago
Florian Zeitz
984bc4a35e
util.dataforms: Fix verfication for booleans
14 years ago
Florian Zeitz
ea0a2a6ecb
util.dataforms: Fix verfication for booleans
14 years ago
Florian Zeitz
35f933d4a5
util.dataforms: Fix form verification
14 years ago
Florian Zeitz
6033bbbd91
util.dataforms: Fix form verification
14 years ago
Florian Zeitz
876f43f354
util.dataforms: Add field verification logic
15 years ago
Waqas Hussain
b7e51a203d
Monster whitespace commit (beware the whitespace monster).
15 years ago
Florian Zeitz
1f7f8e57a3
util.dataforms: Add list-multi support
16 years ago
Florian Zeitz
364d26fb31
util.dataforms: Capability to set default for list-single
16 years ago
Matthew Wild
2bc0606453
Update copyright headers for 2010
16 years ago
Matthew Wild
577ff7d3b8
util.dataforms: Add optional type parameters (defaults to 'form')
16 years ago
Florian Zeitz
22d8917d8c
util.dataforms: Don't require type when parsing form XML
16 years ago