Constraint/validation occurs only when the survey is submitted

4617
6
11-20-2019 02:17 AM
Environnement_1Lausanne
Occasional Contributor

Hi,

I am running through a problem since the latest releases of survey123 (3.5 and above) with constraints.

The issue:

After spending a bunch of time in connect trying to find what was wrong with my formulas in the constraint column, I figure out that the validation would occur only when I attempt to submit the form.

I first though it was a bug, but it seems that this should be the intended behavior since 3.5 and the introduction of inline validation. I could find a few posts about it, but nothing clearly stated in the official survey123 help:

https://community.esri.com/message/863637-what-happened-to-constraints

https://community.esri.com/message/882496-grid-meets-read-only-and-constraint

https://community.esri.com/message/890114-constraint-not-working

https://community.esri.com/thread/205058-survey123-connect-now-constraint-not-working (See Evan's issue of august 19)

In the blog posted by Ismael for the 3.5 release, the only statement about it is the following:

Constraint and required messages now appear inline, helping you identify the exact questions in your form that need attention. This is particularly useful when you have long forms, or forms with multiple  pages.

Why this is an issue:

This behavior means that the user can fill the entire form before noticing that a mistake was made.

  • First of all, it is annoying to come back to questions especially when forms are long and users expect to be done with it at the end
  • Calculations can still be made based on the wrong value
  • The user might do (irreversible) mistake on the field before he realizes a wrong value was entered

Example:

Simple example, not so critical (could be much worse):

  • User needs to indicate the maximal diameter of the components found in the ground (gravel, rocks...)
  • Based on that value, the survey indicates the weight of the sample that needs to be taken
  • The user made a mistake with units (cm instead of mm) and the survey indicates to take a sample of 5kg instead of 30kg
  • The user proceeds, and continue the form while the sample is sent to laboratories...

Possible workarounds:

I can imagine several workarounds, but nothing is worth the original constraint behavior that was before 3.5. Moreover, it means that all the existing surveys need to be updated in order to prevent users from doing mistakes.

  1. Use the inputMask column: very limited (cannot use regex, compare numbers (<>), use other fields or many other usefuls fonctions as the one shown here)
  2. Use an additional field that will show up when the constraint is no met (cumbersome, user can still ignore or miss the message, issues with layout in grid-theme)
  3. Use bind:esri:warning column (still, it is only a warning, not sure if all function listed in 1 would work)

Questions:

Firstly I hope first that I didn't miss anything, and this is the actual intended behavior and not a bug. If so, I would like to say that the inline message is great, clearer that before. The only issue is the moment when the validation takes place.

  1. Is it possible to do the validation while the user is filling the field (as for the input mask column) and not once the user attempts to send the survey?
  2. Do you have any other workaround that would get closer to the original constraint behavior?

Thank you for your time and your help.

Léo

6 Replies
DougBrowning
MVP Esteemed Contributor

Yes since 3.5 validation only occurs when submitting.  I would really like it to be by page.  I have asked but more need to ask for it.

Only trick is to hide the rest of the form until they fill it out.  This will not work for me since my form is so big hiding it crashes the app.

Warnings only work for geopoint questions for some reason.

I started an Idea for this

Add validation by page option to Survey123 

Environnement_1Lausanne
Occasional Contributor

Hi Doug,

Thank you for your answer, validation by page would be indeed a good idea, at least for required fields.

For constraints, I still believe that this is not enough: the user should be warned almost in real time if the answer is not valid. It worked great before, why changing it?

I do think this is a major step back and goes against the digital survey philosophy which should facilitate the navigation and avoid the user to make any mistake. I am quite surprise by this choice made by esri, Survey123 has always seemed to be improved in the good direction (in my opinion), and hope this one will be addressed soon.

Maybe there are advantages (I don't see any) or technical reasons for making those changes, it would be great if we could have some explanations about it. Or at least describe the expected behavior in the documentation, otherwise users might think they made something wrong while testing (as I did).

Léo

leo_SwissGIS
New Contributor III
najeebhall
New Contributor III

There is way here to calculate constraint on geopoints in line that i have tried and it works https://community.esri.com/groups/survey123/blog/2017/10/26/limiting-extent-in-which-input-point-can... 

maybe you can use this and make adjustments to it to suit your needs. may not be possible but worth a try

0 Kudos
DougBrowning
MVP Esteemed Contributor

I am simulating this with emoji inline now.  Check out this post

https://community.esri.com/message/946042-re-can-i-embed-an-image-within-a-note-in-survey123?comment... 

0 Kudos
ChandlerWhite
New Contributor II

Curious if anyone has devised a work-around to this issue... I have a 56 (!) page survey and since the validation of the constraints I have built in to the middle of the survey aren't validated until the user attempts to submit, this requires them to navigate backward ~20 pages to the questions that raised the error. For some background, I have a constraint on a calculate field that is summing a few preceding integer questions.

Edit: I also noticed on the web app that the survey can be successfully submitted without the constraint error prompt appearing as it does on the mobile app.

0 Kudos