Hi! Both approaches above are valid.
Here are the pros and cons I see in each:
Near the bottom of this page:
Open Data Kit » Binding
You will find this example >> "Constraints: Answer must between 4 and 10 characters long (inclusive)"
This should answer your question.
Joe thanks a lot for your reply, but it seems that expression
"string-length(.) >= 4 and string-length(.) <= 10"
is not working in Survey123 Connect . I'm beginner in editing of XML forms so maybe I missed something?
I am a beginner, too, so I am sorry that I cannot provide further guidance to the use of that constraint code. It seems like you might be heading in the right direction with this code, but now it is a matter of trial and error and maybe some good internet searching to find the final answer.
Isn't this fun? Really - it's fun to be challenged and learn new things.
Good Luck and post back to this thread if you find something that works for you. Others will be interested.
Joe was kind of correct on how to go about it, you do need to use binding however Survey123 goes about it a different way than ODK. You will want to use an input mask.
To do this in Survey123 Connect fill in the the body::esri:SurveyMask column (this is the last column in the survey form column x) for your field with the following.
XXXXxxxxxx the capital 'X' makes the character required lower case 'x' is optional to the maximum number of total digits in your mask (in your case 10).
X,x will allow any ascii character
if you just want alphabetic characters use A, a (e.g. AAAAaaaaaa)
numeric characters (0- 9) required = 9, optional = 0 (e.g. 9999000000)
the whole list of options and more about input masks can be found here near the bottom of the page:
Esri custom columns—Survey123 for ArcGIS | ArcGIS
Hope this helps!
Retrieving data ...