Good evening guys, I'd like to know how to do the field validations by javascript for the name, email, and phone fields. for the fields name, cpf or cnpj and phone I was able to not allow numbers for the name and letters for the phone number however I want to delimit the size for the name, and format the phone and also delimit the size, and for the email field I want that when entering the email when changing the field for example it appears error or alert if it does not have the @.
But I want to do this only by taking the field ID, web2py generates the automatic html and does not modify it after it is done, I tried to use 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]/, "");
};