Hyperlink to other ODK Collect questions for non-linear flow

What is the general goal of the feature?
When using ODK Collect, I would like to be able to click a link to move me to a different part of the questionnaire. This is different from the jump view (hierarchy view) because I know where I would like to be able to go with my hyperlink.

What are some example use cases for this feature?
There may be several sections of the questionnaire. The hyperlink would let me go to the beginning of each section, for example. I believe this is already a feature in SurveyCTO, for comparison.

What can you contribute to making this feature a reality?
I can contribute by adding code to pyxform, ODK Collect, helping discuss a specification, writing documentation, etc.

2 Likes

By 'sections' I assume you mean groups?

How does SurveyCTO (ie how would we) handle links that might go to questions or groups that are not relevant (ie their relevant='...' expression evaluates to false). One issue I envision with being able to 'jump' anywhere - and to any depth - within a form is that it would appear to bypasses the relevant show/hide navigation logic intrinsic to XForms. So I'd be interested to understand how SurveyCTO deals with hyperlinks vs relevance.

1 Like

I do not mean groups necessarily. We have surveys where there are several related questions in a row. They do not necessarily have to be in a group (in our case, they are usually not in a group).

I agree that it doesn't make sense to be able to jump to a prompt that is not relevant. As for how SurveyCTO handles it, I do not know. One simple way to handle trying to jump to a prompt with a false relevant is to show a toast message saying the prompt is not relevant and do nothing.

This is very similar to the jump view / hierarchy activity in ODK Collect where instead of opening up the jump view then clicking a prompt and then moving to that prompt, we would have in mind the prompt we want to move to with the hyperlink and after clicking it, move to that prompt.

1 Like

How SurveyCTO handles hyperlinks to other parts of a form

Instructions
Taken from https://pma2020trial.surveycto.com/help.html;#Help_Designing-forms_additional-topics_designing-for-nav:

Within a field or group label, for example, you can hyperlink to another field or group by simply adding a ${fieldname} or ${groupname} reference (hyperlinked references are always enabled for web forms; on Android, enable the Hyperlink field references option in SurveyCTO Collect). For example, say that you have two different modules for two different respondents (in groups named "module1" and "module2"), followed by a concluding section for the surveyor (in a group named "module3"), and you want to offer surveyors the option to easily fill out these modules in any order. Just before module1, between module1 and module2, and between module2 and module3, you can add note fields that reference ${module1}, ${module2}, and ${module3} in each of their labels. When hyperlinked field references are enabled, these group references will display hyperlinked labels that the surveyor can use to jump to any of the three modules.

Example snippet of question definition in the form editor

Example of what it looks like in the browser

I'm not actually sure why the hyperlinks are displaying as "...", but I haven't used SurveyCTO much so I'm probably missing something obvious.


TLDR

Basically, if the hyperlink points to something that is currently relevant, the hyperlink is active. If the question is not relevant, then hyperlink is deactivated, and the hyperlink label simply displays as plain text. Selecting the text will not do anything.

Presumably SurveyCTO must also be walking up the target's group hierarchy too when determining whether to disable a link or not, since its possible for a specific question's relevant expression to be true, but the subgroup its contained in (or any of its parents) is not-relevant (which would normally prevent you from reaching the question...).

Being able to jump around a form like this - whilst still preserving relevant logic - would certainly allow for some interesting non-linear form workflows! Though I imagine it could make it a bit harder for a form designer to determine best-practices around when to use skip logic (ie relevance) vs these psuedo-goto links.... "spaghetti forms" anyone? :wink:

Very interesting. Thanks for sharing. :+1:

I believe the reason your link is "..." is that you didn't fill out a label for the thing you link to. When I hyperlink in CTO, I wrap the question I want to link to in a group and use the group variable for the hyperlink and then the label for that group is what is shown as the link. If you don't have a label on your group, it will appear as "..."

As for how to not let people jump somewhere that they shouldn't go, I am careful to not show the page with the link (using relevance) unless they should actually see it. An example of this is offering a link to jump back to a specific question and then having another hyperlink to jump forward again once they correct their answer. You wouldn't want people to see the jump forward link unless they actually reached that later part of the survey at least once to prevent allowing them to skip swaths of the survey. I use a calculate_here variable named something like see_link right before I show the jump back link and set it to 1 and then once they jump back, I use the value of see_link for the relevance to determine whether they can see the link to jump forward.

Another interesting thing about the CTO hyperlinks is that they are red at first but then once you click on them and fill out a full section, they turn green once all the questions in the group you linked to are filled out.

I used this to make a menu for a project where each of 12 rooms was listed out as hyperlinks and enumerators could go to whichever room first and then it was super clear when they had finished all the rooms because the links turned green and as they finished a room, they would be shown another copy of the hyperlink list to pick the next room to jump to. It came out really slick and my client was super happy.

I realize that ODK has different features than CTO and sometimes it is a better fit (like the way that questions can show up AJAX style in ODK but CTO doesn't have that). But there are some things in CTO that are cool too, like this hyperlinking. It would be neat if ODK had hyperlinks too. :slight_smile:

1 Like