Collapsible form section

Is it possible to create collapsible form sections in xslx forms?

Hi @robinmurphy,

Could you please elaborate more about the use case or scenario? I am not sure if XLSForm has collapsible function but wondering if skipping would help?

Hi @robinmurphy

is your use case similar to Design + Code examples?

Hi @niraj and @munjoma

Thank you for taking the time to get back to us.

Our current use case is to supply a expandable/collapsible sort of ‘cheat sheet’ at the start of an app form whereby the CHW can quickly refer to a section containing a curated list of values, possibly from multiple sources, which could assist in completing appropriate follow up questions.

Does a pre-existing component exist to satisfy this need?
Do we need to create a custom component, and if so, how would we go about doing so?

1 Like

For your “cheat sheet”, would that contain just informational note fields or would there also be questions (with values you want to record)? If it is only notes, then it should be pretty feasible to just use relevant logic and select_one show/hide buttons to create something functional.

Things get more tricky, though, if you have questions you want to show/hide (and you want to record the answer’s to those questions at the end of the form). In this case, the relevant expressions will not work since answers are not recorded at the end of the form for questions that are non-relevant. Our of curiosity, how close is the toggle-able group functionality in this demo Enketo form to what you are looking for? (Groups displayed within a page can be shown/hidden by clicking the triangle next to the group name.) This functionality is not currently supported in the CHT, but we could log it as a feature request…


I think in the “cheat sheet” section of the form will contain informational note fields exclusively.
Then in other sections of the form those values may be used for some relevant and calculation purposes.

That’s a fair point, and we can definitely use that workaround for now.
I was hoping to avoid using a “question” in order to hide the “cheat sheet” block of fields, and have a purpose built component take care of that responsibility.

The link to that toggle-able group component example is exactly what we were looking for!
Please do log that as a feature request.
What would the turnaround time for such a feature be?

I have logged Support collapsible form groups · Issue #8218 · medic/cht-core · GitHub

Turnaround time on something like this usually depends on several factors. If the feature is acceptable to the CHT maintainers (weighing the usefulness with the cost of implementation/maintenance) then the most important other questions for getting it done are:

  • Is there a community member willing to upgrade to a new version of the CHT and use this feature?
  • Is the code change being made by an external contributor?
  • When is there room on the Medic development roadmap to do the work? (involves weighing the priority of the new project against existing planned work)

More details are in the docs.

When we have a partner interested in using a new feature and they are willing to work with us to validate the functionality, we can get them a feature release with the new functionality in a relatively short amount of time. Please feel free to reach out if something like this sounds feasible (for this or any future features).

On a related note, while doing some investigation around this, I did learn about Guidance hints in ODK forms.
These are not currently supported in the CHT, but I have logged Support ODK guidance_hints in forms · Issue #8217 · medic/cht-core · GitHub to add support in the future.

Also, if you go to implement the relevant workaround, one thing to consider is using a no-buttons columns-1 appearance with a select_one question to handle toggling the section display./


That gives you a nice toggle button. (Can even use an image for the button instead of text if you want!)