Specify a masking pattern for an ID question

I am building a survey using XLSForms and I have a question of type “text” that will receive ID numbers. These numbers are composed of 16 digits grouped into blocks like this #-####-#-#######-#-##.

In the constraint column, I have put the right regex so that users can’t input more or less than 16 digits. In the appearance column, I have put numbers so that only the numeric keyboard is shown during data entry.

Now, my question is: can I make sure the form would automatically insert these dashes when the user is doing input?
These dashes are not part of the data, they are just a visual guide to minimize typos.

ChatGPT says there is a new feature called “input masking” introduced recently in KoBoToolbox version 2.024.27 where such thing can be done. Any more info?
I can’t find this feature documented anywhere in the tutorials.

Welcome to the community, @gashakamba!

You will need to input the dashes too. You should be able to make your own regex code by following this support article Restricting Text Responses With Regular Expressions.

Hello @Kal_Lam I like how you reply to many questions on this forum. Thanks for the dedication.
Now, I have read many of your responses to questions similar to this and you seem to always suggest the same thing even to cases that are a bit dissimilar.
For instance, I have further dove deeper into this particular issue and I have found that one can’t basically achieve this functionality with Kobo.
Using regex() to restrict text responses is quite different from my question and I indeed am already extensively using these types of constraints in my form.

1 Like