AnsweredAssumed Answered

Constraint/validation occurs only when the survey is submitted

Question asked by AO_VD_ENV1 on Nov 20, 2019
Latest reply on Aug 6, 2020 by dougbrowning

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

Outcomes