Page 1 of 1

How to implement Custom Mask for text fields?

Posted: 2015-09-25 15:17
by wemersonrv
Hi, i need to make custom masks for dome fields, for brazilian documents, like:

1- CPF
- 11 sequentially numbers stored widhout mask, like: 11111111111
- The mask : ###.###.###-##
- Number masked: 111.111.111-11

2- CNPJ
- 14 sequentially numbers stored widhout mask, like: 11111111000111
- The mask : ##.###.###/####-##
- Number masked: 11.111.111/0001-11

3- Brazil Phone Number
- 14 sequentially numbers stored widhout mask, like: 11111111000111
- The mask : (##) ####-####
- Number masked: (64) 9285-7651

Notes
#1 - In some states, we have phones with a 5 digit prefix, then the mask turns on (##) #####-#### and i really don't know how to do these changes on appgini.

#2 - I am working with an existing database and the 3 types of fields (cpf, cnpj and phones) are text fields with 11, 14 and 11 chars respectively.

Can you help me?

Re: How to implement Custom Mask for text fields?

Posted: 2015-10-12 10:56
by udayvatturi
Use magic hooks.
(Tablename-dv.js) and put the following code in it.

$("#number").mask("9999.999.999-99 ");

Example: http://jsfiddle.net/ZYH9f/345/