-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
itext identifiers prevent duplicate choices from displaying distinct labels #585
Comments
Thanks @tedrick for this detailed report. To flesh out the problem further - generating a XForm with the duplicate names as-is does not pass ODK Validate. I created a copy of the provided XForm, and manually inserted the duplicate itext node as shown below.
Using ODK Validate v1.16.0, this resulted in the following error message. Without reading too far into the underlying
There is a XLSForm setting @lognaturel is duplicate choices with itext a use case you'd want to support? I think it's inadvisable form design, and preferable to instead either use distinct choice values and collapse them in analysis, or use one choice with a label that reflects the duplicates e.g. "Skipped or Not Applicable". I don't fully understand the cascading select use case mentioned in the docs but it seems odd to need this setting for that. An approach where the choice names are used as-is seems like it'd need a javarosa + validate + pyxform changes to support (and maybe collect / enketo as well). An alternative could be that pyxform appends something to the itext id (e.g. a dash and then a number such that it is predictable) to make sure the ids are unique if they aren't already, and allow_choice_duplicates = yes. |
@lindsay-stevens - yes, this is in the context of We generally agree on the inadvisability of having duplicate choice values in a choice list, though as has been commented elsewhere, there are a few cases where it makes sense (#373 has a good discussion on this). If it's decided to mark as a known limitation, I believe we're fine with that - this was generated though internal testing around some issues related to choice lists and we don't have a customer use case at this point time. |
User report and confirmation that it's fixed with the new version: https://forum.getodk.org/t/pyxform-duplicating-choices-labels/44037 |
Software and hardware versions
pyxform v1.7.0, Python v3.7.4
Problem description
When a form has multiple languages, the labels are stored whithin the
<itext>
section and referred to by ID. The ID pattern uses thename
of the choice as part of the ID string. If choices have duplicate values, only one of the duplicate choice's label is stored as all duplicate choices would have the same ID.Steps to reproduce the problem
Example form: multilang_duplicatechoice.xlsx
The resulting XML only has 3 choice entries in the itext section XML:
Expected behavior
Ideally, each choice will display as written in the XLSX file.
Other information
Given that the existing ID pattern is attempting to create a unique ID per string (as 2 questions with the same string will have different IDs since the question properties are used to generate the ID), perhaps the ID could be switched to a GUID?
The text was updated successfully, but these errors were encountered: