Mask in text field without using jquery

0

Does anyone know a gem for ROR that does this job? Add masks to fields like phone, email, date, etc. and let me also create my own masks. Thank you.

    
asked by anonymous 30.10.2014 / 19:15

2 answers

1

I honestly do not believe there are any, since the masks must be done on the client side, and the gems usually act on the server side. I use a gem , but it is nothing more than the jQuery loaded in the project, it works similar to bootstrap-rails .

The mask library loaded in the system is jquery.inputmask .

I recommend gem Jquery :: Inputmask :: Rails for being very useful and well documented.

    
09.11.2014 / 11:12
0

You can use htlm chews with the pattern parameter.

Example:

<%= ff.text_field :telefone_comercial, placeholder: '(DD)1234-5678', pattern: '\([0-9]{2}\)[0-9]{4,6}-?[0-9]{3,4}$' %>

The mask is made by regex. link In this link there are several patterns already written.

    
15.08.2016 / 19:23