medic / pyxform

A Python package to create XForms for ODK Collect.
BSD 2-Clause "Simplified" License
3 stars 3 forks source link

Do not warn when converting form that has choices with images but no labels #9

Open jkuester opened 2 years ago

jkuester commented 2 years ago

The new enketo supports the no-buttons appearance which allows for select fields for choices that have images, but no labels. (See the grid_test and grid_2_columns fields on the Enketo Widgets Demo Form for an example of what this looks like.) Annoyingly, pyxform will log a warning about any choice that does not have a label. It would be nice to see if we could find a way around this warning, perhaps by leveraging the NO_LABEL functionality that already exists.

Currently using NO_LABEL does not work since our existing patch in pyxform for NO_LABEL seems to break the functionality of keeping the image label with no text.... Currently, if you do not include any text in the label, a warning is printed and, in the itext section of the generated XML, the expected text elements are included for the images. E.g.:

          <text id="static_instance-happy_sad-0">
            <value form="image">jr://images/happy.png</value>
          </text>

But, if you put NO_LABEL as the label, these text elements are not created at all....

Context: https://github.com/XLSForm/pyxform/issues/610