getodk / build

ODK Build is a drag-and-drop form designer for ODK XForms. Thousands of users around the world depend on it for their data collection campaigns. Contribute and make the world a better place! ✨📝✨
https://build.getodk.org/
Other
110 stars 82 forks source link

Support guidance and short label #242

Closed florianm closed 3 years ago

florianm commented 3 years ago

Why

Guidance is very useful to include "training" / "one off explanation" level information which in itself would be too much for the form, but also should be "on tap" for novice enumerators.

What

It would be great if guidance fields were natively supported by ODK Build. The implementation looks very similar to short labels, so if it's not too much extra work, it would make sense to add both.

Who

I don't yet understand the code architecture and what's happening well enough to offer a PR. If anyone with deeper knowledge of the code base could point me into the right direction, I'd be happy to give it a go. I'm lost as to where to generate the content of control.hint as dual node <value>, and <value form="guidance">(control.js:98?).

Alternatives

I'm aware of the XLSForm path but Build is just such an amazing tool I'd like to keep using. My current hack is to enter the hint and the guidance text into the hint field, separated by "GUIDANCE", and to batch-replace "GUIDANCE" with </value><value form="guidance">.

More context

From #238 Most help text I'm showing as hints would be far better off as "guidance" with the option to collapse and thus make the form more compact for experienced enumerators, while allowing to include sufficient help text to enumerators in training.

Found in XForms spec:

<text id="how-old-label">
    <value>How old are you?</value>
    <value form="short">Age</value>
</text>
<text id="how-old-hint">
    <value>Enter a number</value>
    <value form="guidance">If the age is less than 18, the remainder of the survey will be hidden.</value>
</text>

Possible implementation: ODK Build could offer a field "guidance" after the field "hint" input which adds the guidance as <value form="guidance"...</value> to the respective <text id="...:hint"> nodes. And while we're there, support for a short label might be very similar to add.

A hack for now:

florianm commented 3 years ago

Closing this issue as #244 was merged.