Custom Validation for jQuery Validate (two method in one)?

JQuery.validator. AddMethod("documentoId", function(value, element) { if (value. Length Call(this, value, element); } }, 'Documento inválido'); Full example changing the error message jQuery.validator.

AddMethod("documento", function(value, element) { // remove pontuações value = value. Replace('.',''); value = value. Replace('.

',''); value = value. Replace('-',''); value = value. Replace('/',''); if (value.

Length Call(this, value, element)){ return true; } else { this.settings.messages.documento. Documento = "Informe um CPF válido. "; } } else if (value.

Length "; } } return false; }, "Informe um documento válido. ").

– Felipe Oriani Sep 12 at 19:36 Updated my answer. I'm not sure what error message you want changed but give the above a shot. – rwilliams Sep 12 at 21:26 Perfect rwilliamsn, it's everything I need!

Thank you! – Felipe Oriani Sep 12 at 22:22.

How about creating those function outside of the scope of the validation definition (i. E not using anonymous functions)? Function cpfValide(value,element) { //something } function cnpjValide(value,element){ //something } jQuery.validator.

AddMethod("cpf", cpfValide, "CPF inválido! "); jQuery.validator. AddMethod("documentoId", function(value, element) { return cpfValidate(value,element) || cnpjValidate(value,element); //.. }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions