Using a Mask makes the input required even when the atribute is not visible?

2394
4
10-06-2016 11:52 AM
HectorMelendez-Alvarado
New Contributor III

I've added a body::esri:inputMask to a decimal type pH value in my form using the documented sample "B9.99;-" The field should be optional but adding the mask makes it a require since the form never validates when the value is left empty. In addition to this the pH value has a relevant constraint where it only shows up given a specific condition so even when the attribute is not visible the survey123 returns an invalid warning. Also tried adding a default value of 0 but continued to get the same error.

Any idea as how to solve this?

Tags (2)
0 Kudos
4 Replies
IsmaelChivite
Esri Frequent Contributor

The expected behavior is that an input mask filters the user  input to prevent the user  from typing an entry that does not conform with your mask. Input masks should not however prevent you from submitting the survey.  For example, if your input mask is B9.99 but you do not flag your question as required, you are expected to be able to submit the survey even if you leave the answer empty.  It may be best if you share your survey (attaching the survey to a comment in this thread using the advanced editor) so we can have a closer look at your problem.

Please also let us know what is the version of Survey123 you are using.

0 Kudos
HectorMelendez-Alvarado
New Contributor III

I've attached the survey form. The pH values (there are two) only show when the first value of the form is either "Cuenca" or "Playa". I'm using the latest version of survey123 connect 1.8.27

0 Kudos
IsmaelChivite
Esri Frequent Contributor

Hi Hector. I had a look at your survey. Here are some  notes:

  • The reason why Survey123 does not let  you submit values is because you are combining an input mask with a decimal type of question. Your input mask  is by default creating a value which is not a valid decimal number. Unless the user types a proper decimal value, Survey123 will  complain.
  • I suggest that you change the question type to text to avoid the above behavior.  If you want your pH values to be stored as a number in the geodatabase, then use the bind::esri:fieldType column to set the target esri field to be esriFieldTypeDouble

There are  two  more issues with this survey:

  • Some values in the NAME column of the Survey worksheet are highlighted in red. This is because they are repeated. Values in the Name column must be unique.
  • In the choices worksheet, you also have values in the Name column that are invalid. Values in this column must not contain spaces or include non-ascii characters.

I am attaching a modified version of your survey for you to try.

An alternative approach for pH values may be to make the question types decimal, remove the input mask and add a constraint that will ensure values are within 0 and 14. Hope this helps.

Jing_Sun
Esri Contributor

Hello Ismael,

I've included the inputMask 'B9.99;-' for a decimal question, using the exact same way Hector described - just trying to replicate the issue. 

And I notice that leaving the question blank will not trigger the invalid warning when submitting the survey result. Does that mean this is no longer an issue and we can use inputMask for a decimal or integer question and do not need to make them 'text'?

Because I am using an inputMask (9000) for my integer question to limit the number of digits, then I remember I saw this post years ago and it seems the behavior had changed.

Cheers,

Sun 

0 Kudos