inputs icon indicating copy to clipboard operation
inputs copied to clipboard

NO LONGER MAINTAINED - Add a very simple way, masks in form fields.

= Inputs

Add helpers to create text_field with masks.

== Dependencies

Plugin jRails http://github.com/aaronchi/jrails/tree/master

script/plugin install git://github.com/aaronchi/jrails.git

== Installation

script/plugin install git://github.com/jtadeulopes/inputs.git

== Rake Tasks

Updates javascript files and remove unnecessary files.

rake inputs:update

== Usage

Add in the head tag:

<%= javascript_include_tag :defaults %> <%= javascript_include_inputs %>

In form:

<%= masked_text_field(:user, :tel, :size => 13, :mask => '(99)9999-9999') %>

Other Examples:

Date: <%= masked_text_field(:user, :birth, :mask => '99/99/9999') %>

CPF: <%= masked_text_field(:user, :cpf, :mask => '999.999.999-99') %>

= Use Formtastic?

A short description, taken from his {README}[http://github.com/justinfrench/formtastic]

"Formtastic is a Rails FormBuilder DSL (with some other goodies) to make it far easier to create beautiful, semantically rich, syntactically awesome, readily stylable and wonderfully accessible HTML forms in your Rails applications."

More information on using the Formtastic, you can find {here(en)}[http://github.com/justinfrench/formtastic] or {here(pt-br)}[http://jlopes.zigotto.com.br/tag/formtastic]

== Usage

New option :mask was added, you can simply write:

<% semantic_form_for @product do |form| %> <%= form.input :price, :mask => :decimal %> <%= form.commit_button %> <% end %>

Automatically be added to field a mask Price.

You can use other masks, see:

  • phone
  • phone-us
  • cpf
  • cnpj
  • date
  • date-us
  • cep
  • time
  • cc
  • integer
  • decimal
  • decimal-us
  • signed-decimal-us

Or create your own type of mask, for example:

<% semantic_form_for @product do |form| %> <%= form.input :year, :mask => '9999' %> <%= form.commit_button %> <% end %>

=== Based on plugins: JSMask by Ozéias Sant'ana:: http://github.com/ozeias/js_mask/tree/master meioMask by Fabio M. Costa:: http://github.com/fabiomcosta/jquery-meiomask/tree/master

Copyright (c) 2009 Jésus Lopes, released under the MIT license