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?
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.
Hi Hector. I had a look at your survey. Here are some notes:
There are two more issues with this survey:
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.
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