Write input mask function

Hi,
I want to use the input mask formatting for my phone number field. I would like to know if it is possible to customize such a formatting in commcare. I want my phone number to be 12 digits / characters and look display a format : 0000-000-000.

Than

Hi Mawatta,

Unfortunately, we don’t support input masks in our string inputs. We do
support regular expressions as well as other input validation conditions
(like string-length()).

If the field is going to be displayed at a later time (or used in reports)
and the goal is to have the data value associated with the case in that
format, you could use a validation condition on the input to ensure it is
the right length, then you could use a hidden value with a
*calculate *expression
like

if(not(string-length(#form/phone_input) = 10),
’’,
concat( substr(#form/phone_input, 0, 4), ‘-’, substr(#form/phone_input,
4, 7), ‘-’, substr(#form/phone_input, 7, 10)
)

Which would take a value input by the user as a 10 digit long number (in
the “phone_input” question), then transform it into the format you are
describing.

-Clayton