0
Good evening people, I would like to know how to validate the fields by javascript for the name fields, email and phone. for the name, Cpf or cnpj and phone fields I managed not to allow numbers for the name and letters for the phone number but I want to delimit the size for the name, and format the phone and delimit the size too, and for the email field I want that when typing the email when changing field for example it appears error or Alert if you do not have the @.
But I want to do this by taking only the Id of the field, web2py generates the automatic html and not to modify after it was done, I tried using Jquery Mask and there was no success. if possible without Jquery.
document.getElementById("Pedido_Nome").onkeyup = somente_letras;
function somente_letras() {
this.value = this.value.replace(/[^\w\.]|\d/g, '');
};
document.getElementById("Pedido_Telefone").onkeyup = somente_numeros;
function somente_numeros() {
this.value = this.value.replace(/[^0-9]/, "");
};
Thank you very much.
– Grupo Impacta