Page 1 of 1
mask CPF e Tel
Posted: 2019-02-07 13:25
by wferreira
how to put mask for cpf and tel?
Re: mask CPF e Tel
Posted: 2019-02-08 21:57
by pbottcher
Hi,
what do you try to acheive. Can you make an example?
Re: mask CPF e Tel
Posted: 2019-02-15 16:53
by wferreira
good afternoon!
It would be so for phone (xx) xxxxx-xxxxx
Cpf: xxx.xxx.xxx-xx
When the user enters the mask is ready
Re: mask CPF e Tel
Posted: 2019-02-16 15:26
by sjohn
Was it not possible for you to use the built-in format option? Eventually add/edit date formats?
- format.jpg (37.29 KiB) Viewed 2231 times
Re: mask CPF e Tel
Posted: 2019-02-17 22:29
by peebee
This jquery mask also works extremely well and includes input validation. I use it myself.
https://github.com/RobinHerbots/Inputmask
Can be loaded with hooks.
Call the jquery.inputmask.bundle.js in your hooks/header-extras.php
and include the jquery Inputmask function in your hooks/tablename-dv.js
You can even add jquery UI widgets (datepicker etc) to what would otherwise be a text field.
Just use the field <id> as the selector. The plugin is comprehensive, has good usage instruction and plenty of examples.
Example:
Code: Select all
$j(document).ready(function(){
$j(#yourfield).inputmask("99-9999999"); //static mask
$j(#yourfield).inputmask({"mask": "(999) 999-9999"}); //specifying options
$j(#yourfield).inputmask("9-a{1,3}9{1,3}"); //mask with dynamic syntax
$j('#dob').datepicker({
dateFormat: 'dd/mm/yy',
yearRange: '-100:+0',
changeMonth: true,
changeYear: true
}).inputmask('dd/mm/yyyy');
});