Skip to content

pyxform creates bogus required binding for groups #856

Description

@tiritea

Somewhat of an edge case, but I came across the issue that if you inadvertently add a required setting against a group, that pyxform will obediently create a new binding in the resulting XForm against the group , with required='true()'. However, unlike perhaps the original intent and interpretation just by looking at the XForm, this new required setting is not in fact inherited by any sub-elements, and is completely ignored by both the Collect and Enketo clients - that is, any elements under the group, on their own, do not become required.
[this is perhaps confusing because that is exactly how relevance on a group is indeed inherited; if the group is tagged non-relevant then everything under the group will then become non-relevant...]

Although there is no obvious breakage - both clients basically ignore this group setting anyway - it is probably better to detect that an incorrect/inadvertent required setting is being attempted against a group and throw a suitable error, rather than silently adding what is effectively a meaningless (and arguably misleading) binding into the XForm that has no actual effect.

Example, the following XLSForm

Image

RequiredGroup.xlsx

Produces the following XForm:

Image

RequiredGroup.xml

Note the: <bind nodeset="/data/mygroup" required="true()"/>

(this was generated using latest XLSForm Online, presumably running the latest pyxform under the covers)

I've confirmed that this group setting is ignored by both ODK Collect and Enketo - the question/element binding within the group does not become required. eg

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions