ODKX: Constaint / warnings - avoiding hard stops

Hi all

I was wondering if anybody know of a clever (and preferably) easy method of implementing warnings / soft stops in a survey?

My current method is using a custom alert-prompt which calls a js alert() function, eg:
begin screen
some statement
end screen
if some statement is not true
alert(‘The error’)
goto ‘previous screen’
end if
A session variable makes sure the alert()-prompt only activates 1 time.
The method works, but it has some problems:

  • If the promt is activated, the survey do not jump directly to ‘previous screen’, only when ‘next’ is pressed the goto clause is activated.
  • I would like to implement quite a few soft stops, and this method is a bit ‘clumsy’.

Any advice?

Hi @Andreas!

The constraint column can be used for hard stops, or the required column (if the constraint is that you need to answer), but it sounds like you only want soft stops and warning messages.

I don’t think there’s an easy way to go to another screen without pressing next – that is how you generally navigate along. You probably can achieve the same thing without a custom prompt just using if statements, notes with the warning, and then using section navigation or goto. The controller options are documented here: https://docs.opendatakit.org/odk-x/survey-controller-actions/?highlight=goto

If you can describe a bit more about what you are trying to do with this and why that might help us think of other options.

Hello @Andreas,

I personally wouldn’t allow enumerators to skip with any critical errors on screen … but that’s different to your current needs I guess…

To achieve what you described (assuming I got it correct) go to form management settings

and for the constraints tick defer validation until finalized which let’s users go over the form and only check for errors at end… I use this method sometimes when administering some simple exams through ODK

You could also trigger note type questions with information to warn user of a possible violation of rules and remember to set their required property to off

Hoping this helps,

Jules R