Skip to content
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

autocomplete appearance does not work on select_multiple (despite ODK documentation) #1301

Open
ChasNelson1990 opened this issue Mar 8, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@ChasNelson1990
Copy link

Describe the bug

autocomplete appearance does not work on select_multiple.

  • originally discovered as an issue in a large and complex form but see MWE example attached for... a MWE
  • also, originally discovered using a custom Enketo app but confirmed in ODK and...
  • tested by using https://getodk.org/xlsform/ and selecting "Preview in Browser"

To Reproduce
Steps to reproduce the behavior. If applicable please include the smallest possible XLSForm or XForm (as zip or link).

  1. download the attached XLSForm
  2. go to https://getodk.org/xlsform/
  3. click "Preview in Browser"
  4. confirm that you can use the autocomplete function for the first question (select_one)
  5. confirm that you cannot use the autocomplete function for the second question (select_multiple)
  6. go and check the ODK docs to see this (https://docs.getodk.org/form-question-types/#multi-select-widget):
    image

It seems like everything in the ODK Docs (and Forum discussions) implies that autocomplete should work for select_multiple questions. However, I note that it is not explicitly listed anywhere on https://xlsform.org/en/... however-however, the old search appearance is listed as working for all select-type questions for Enketo here: https://xlsform.org/en/ref-table/ - try changing my MWE to search and you will see it still doesn't work.

Expected behavior
Either it should work... or both ODK and XLSForm docs need clarifying.

Screenshots
Working select_one with autocomplete:
image

Not working select_multiple with autocomplete:
image

Browser and OS (please complete the following information):

  • OS: Linux framework 6.7.8-arch1-1 Monorepo setup #1 SMP PREEMPT_DYNAMIC Sun, 03 Mar 2024 00:30:36 +0000 x86_64 GNU/Linux
  • Browser: tested on Chromium Version 122.0.6261.111 and Firefox 123.0.1

Additional context
P.S. it's possible I should have put this as a docs issue to ODK / XLSForms rather than a dev issue to Enketo... happy to move it over if there's no benefit having it here but I thought this is where it was best discussed.

@ChasNelson1990
Copy link
Author

Now, my knowledge of the Enketo codebase is minimal (i.e. about 10 days of exposure) but it seems like the way a select_one and a select_multiple are rendered in the HTML are completely different? select_ones seem to be rendered as an <input/> with <datalist/> (with s) and select_multiple as a <select/> withit's own direct <option/>s.

I don't actually think I see why this is the case... if we changed the select_multiple to be rendered as an <input multiple/> with <datalist/> with <option/>s, would the autocomplete CSS and JS that is used for select_one work for select_multiple as well?

@ChasNelson1990
Copy link
Author

mwe.xlsx

Ten minutes later and it dawns on me that I didn't actually attach anything.

@ChasNelson1990
Copy link
Author

Ah, and I forgot to mention that https://validate.enketo.org/ does correctly show that autocomplete won't work with select_multiple:
image

@lognaturel lognaturel added bug Something isn't working and removed bug Something isn't working labels Mar 8, 2024
@lognaturel
Copy link
Contributor

I thought this is where it was best discussed

Feels right! We generally recommend the ODK forum as a good starting point for questions so that they get more visibility but also fine to keep on Github, especially if it's mostly developer-facing.

Thanks so much for digging deeper!

My first thought was that it could be related to a change in pyxform to always generate secondary instances for selects which revealed differences in Enketo between selects from inline and secondary instance choice lists but given what you followed up with, that's not right.

ttps://validate.enketo.org/ does correctly show that autocomplete won't work with select_multiple

Great idea to check there. That does make it clear the docs diverged from reality for some reason.

I agree with you that in an ideal world select one and select multiple would be less different. In practice, that might be a riskier and more involved change than it may first appear. If you do want to attempt it, we'd welcome a PR.

@lognaturel lognaturel added the enhancement New feature or request label Mar 8, 2024
@lognaturel
Copy link
Contributor

Another quick thought -- depending on what your needs are, you could consider using a text field before your select multiple and a choice_filter using contains(), starts-with(), etc to filter choices. The last value in that field will be part of the submission so it's not as elegant but might be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants