7
I am using the jQuery Validation Engine with this file of translations into Portuguese. I added in Javascript the following line:
"cnpj": {
"regex": /^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/,
"alertText": "* CNPJ inválido"
}
In ASPX I use:
asp:TextBox ID="txtCNPJ" runat="server" CssClass="validate[required,custom[cnpj]]
However, this validation is not very efficient, since it only checks the number of characters.
How can I make a method to validate CNPJ and continue using Validation Engine in this way?
What is "CNPJ " ?
– Sergio
@Sergio It is a document referring to the national register of companies here in Brazil: "Cadastro Nacional de Pessoa Jurídica". The number of each CNPJ is in question regex format and the last two are check digits.
– utluiz
@utluiz, Aha. I think I’m kind of unqualified :P But by the way, is there a pattern? order of letters (and what), numbers, points? It is based on name or generated by state?
– Sergio
@Sergio A Wikipedia has everything.
– utluiz
@utluiz boa! + 1 for Wikipédia :)
– Sergio