Search code examples
appceleratorappcelerator-titaniumappcelerator-alloy

Mask an input on appcelerator


I have a phone input on my app:

<TextField id="FieldTelefone" class="textArea"></TextField>

I want to creat a telephone mask, preferably with REGEX, but I am having a hard time to do so on appcelerator.

I need it to be: (xx)_xxxx-xxxx or (xx)_xxxx-xxxxx

the brazilian phone numbers pattern.

but I am not being able to do it with only javascript, I could however validate it, could anyone help me ?


Solution

  • This git repo will help you: https://github.com/Nyvra/titanium-appcelerator-fields-mask

    You surely have to extend the script, but there you'll see how it works