Recall the previous answer for the next answer option

So yes indeed the difference in behavior here is due to pyxform; specifically, Kobo is currently running an earlier version whereas XLSForm Online is running the very latest. There have been a number of changes made in the interim; I cannot determine all the ones that are directly responsible here, other than 647: include all choice lists in output by lindsay-stevens · Pull Request #736 · XLSForm/pyxform · GitHub.

However, I have been able to determine how to force Kobo’s current version of pyxform to generate the equivalent XForm definition that works. Specifically, you need to:

  • force pyxform to generate a nodeset for all choice list options [ie PR #736, above]
  • force the relevant choice list to have translatable itext whenever it contains a dynamic label [PR?]

Below is a new version of your form showing the necessary changes to accomplish this:

Recall Answer2.xlsx (12.2 KB)

Adding a choice_filter= true() basically forces pyxform to make all choice lists into nodesets. This behavior became standard behavior starting in pyxform v3. And adding an explicit label::English - instead of just label - forces pyxform to make all the choice labels translatable, which appears to be necessary to correctly resolve the ${Q1_Others} dynamic label.

Once you do this, the deployed XForm from Kobo, using the earlier pyxform version, is ostensibly equivalent to what the latest pyxform version produces. Hence the form should now behave as you observed.

I’ve deployed this to Kobo and tested against both Enketo and KoboCollect successfully:



Note, Kobo will be shortly updating pyxform so these changes may not be required for much longer, although there is also no harm leaving them in.

Addendum
I do note, however, that Enketo does not immediately refresh the second select’s options list as soon you enter a value for Other (instead you’ll have to select/deselect something to force a refresh. You may be able to switch to a paging style to workaround this. but I haven’t tried it. This doesn’t affect KoboCollect because it refreshes as soon as you swipe to Q2.

Its also worth pointing out that your form as written is somewhat misleading, because it is not actually “Others” (plural).; if you enter multiple other names of fruit - comma or spaced separated doesn’t matter - they will all appear again as one in the followup select.

[but if you do want to handle multiple others, then you are dealing with a whole different kettle of fish! :slightly_smiling_face:]

1 Like