MaskedInput (JS) for Formtastic
MIT License
h1. formtastic_masked_input
Sometimes you want to mask your fields like phones, zipcodes or something like that.
This plugin will do it for you if you are using formtastic.
Note: the javascript file depends on Prototype 1.6.1 and Rails uses Prototype version 1.6.0.3, just update your prototype.js
h2. Installation
h3. Plugin
h3. Gem
Add gem dependency to your environment.rb:
And generate the masked_input.js:
h2. Usage
Include prototype.js and masked_input.js into layout:
And update your form field:
h2. Masks
The available masks are made for Brazil:
If you want to add a custom mask, you can edit masked_input.js around line 301 (preferred) or add directly into your layout:
h2. Credits
Special thanks to "Justin French":http://github.com/justinfrench for "formtastic":http://github.com/justinfrench/formtastic and "Bjarte K. Vebjørnsen":http://github.com/bjartekv for "MaskedInput port for Prototype":http://github.com/bjartekv/MaskedInput.
h2. TODO
Copyright (c) 2010 Gabriel Sobrinho, released under the MIT license