No description or website provided.
CoffeeScript JavaScript
Latest commit 2423143 Aug 31, 2012 @rafaelks rafaelks Merge pull request #1 from alfonsocora/master
Coffeescript version
Failed to load latest commit information.
README.markdown Coffeescript version Aug 31, 2012
mask.js Some adjusts in the code Oct 14, 2011



This "Class" will help you make maskfields in your textFields of Titanium. For example: The postcode 99999999, will be 99999-999.


It's very easy... You just have to use this function, in the "change" textField event.



var textfield = Ti.UI.createTextField({
    hintText: "Postcode",
    left: 5,
    right: 5,
    top: 150,
    bottom: 150

textfield.addEventListener("change", function() {
    Mask.mask(textfield, Mask.postcode);

Do you need a generic mask in your field?

You will need to send three parameters in the function: regex (required), syntax (required) and maxValue (optional). See the example:

textFieldPostcode.addEventListener("change", function(evt) {
    Mask.mask(textFieldPostcode, Mask.generic, {
        regex: /^(\d{5})(\d)/,
        syntax: "$1-$2",
        maxValue: 9