{"absolute_url": "https://alexjosesilva.snipt.net/script-com-jquery-validation-ddfb5a21/", "blog_post": true, "code": "\n\n\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\n\n\t\n\t
\n\n\t
\n\t\t\n\t\t
\n\t\t\t
\n\t\t\t\t

\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t

\n\t\t\t\t\n\t\t\t\t

\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t

\n\t\t\t\t\n\t\t\t\t

\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t

\n\t\t\t\t

\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t

\n\t\t\t\t\t\t\t\t\n\t\t\t\t

\n\t\t\t\t\t *\n\t\t\t\t\t

\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t

\n\t\t\t\t\n\t\t\t\t

\n\t\t\t\t\t\n\t\t\t\t

\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t
\n\t
\n\n\n\n", "created": "2014-07-09T14:15:27.467473", "description": "Exemplo de uso de JqueryValidation", "description_rendered": "Exemplo de uso de JqueryValidation", "embed_url": "https://snipt.net/embed/0ff7ebac649b32dcc0bf15c06c0301a8/", "full_absolute_url": "https://alexjosesilva.snipt.net/script-com-jquery-validation-ddfb5a21/", "id": 135730, "lexer": "html", "line_count": 143, "log_entries": [], "meta": null, "modified": "2016-12-25T14:18:13.161082", "publish_date": "2014-07-09T14:15:00", "raw_url": "/raw/0ff7ebac649b32dcc0bf15c06c0301a8/", "resource_uri": "/api/public/snipt/135730/", "slug": "script-com-jquery-validation-ddfb5a21", "stylized": "
  1\n  2\n  3\n  4\n  5\n  6\n  7\n  8\n  9\n 10\n 11\n 12\n 13\n 14\n 15\n 16\n 17\n 18\n 19\n 20\n 21\n 22\n 23\n 24\n 25\n 26\n 27\n 28\n 29\n 30\n 31\n 32\n 33\n 34\n 35\n 36\n 37\n 38\n 39\n 40\n 41\n 42\n 43\n 44\n 45\n 46\n 47\n 48\n 49\n 50\n 51\n 52\n 53\n 54\n 55\n 56\n 57\n 58\n 59\n 60\n 61\n 62\n 63\n 64\n 65\n 66\n 67\n 68\n 69\n 70\n 71\n 72\n 73\n 74\n 75\n 76\n 77\n 78\n 79\n 80\n 81\n 82\n 83\n 84\n 85\n 86\n 87\n 88\n 89\n 90\n 91\n 92\n 93\n 94\n 95\n 96\n 97\n 98\n 99\n100\n101\n102\n103\n104\n105\n106\n107\n108\n109\n110\n111\n112\n113\n114\n115\n116\n117\n118\n119\n120\n121\n122\n123\n124\n125\n126\n127\n128\n129\n130\n131\n132\n133\n134\n135\n136\n137\n138\n139\n140\n141\n142\n143
<!DOCTYPE html>\n<html lang="en">\n<head>\n\t<script src="../lib/jquery.js"></script>\n\t<script src="../dist/jquery.validate.js"></script>\n\t\n\t<style>\n\t\tform.cmxform label.error{\n\t\t\tcolor: red;\n\t\t\tfont-style: italic;\n\t\t}\n\t\t.classErro{\n\t\t\tcolor: red; \n\t\t\tfont-style: italic; \n\t\t\tbackground-color: #FFDAB9;\n\t\t\twidth: 300px;\n\t\t}\n\t</style>\n\t\n\t<script>\n\t/* Sucesso ao validar*/\n\t$.validator.setDefaults({\n\t\tsubmitHandler: function() {\n\t\t\talert("submitted!");\n\t\t}\n\t});\n\t/* Regras de negocios*/\n\t$().ready(function() {\n\t\t$("#commentForm").validate({\n\t\t\t\trules: {\n\t\t\t\t\tname: {\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tminlength: 20,\n\t\t\t\t\t},\n\t\t\t\t\tcpf:{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tminlength: 11,\n\t\t\t\t\t\tnumber: true,\n\t\t\t\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\tnmat:{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tminlength: 11,\n\t\t\t\t\t\tnumber: true,\n\t\t\t\t\t},\n\t\t\t\t\ttvinculo:{\n\t\t\t\t\t\trequired: true\n\t\t\t\t\t},\n\t\t\t\t\ttipoBeneficiario:{\n                        selectcheck: true\n                    },\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t},\n\t\t\t\tmessages: {\n\t\t\t\t\tname: {\n\t\t\t\t\t\trequired: "Por favor preencha o campo Nome <br>",\n\t\t\t\t\t\tminlength: "O campo Nome minimo de caracteres  20 <br>"\n\t\t\t\t\t},\n\t\t\t\t\tcpf: {\n\t\t\t\t\t\trequired: "Por favor preencha o campo CPF<br>",\n\t\t\t\t\t\tminlength: "O campo CPF minimo de caracteres  11 <br>",\n\t\t\t\t\t\tnumber: "somente numeros <br>"\n\t\t\t\t\t},\n\t\t\t\t\tnmat: {\n\t\t\t\t\t\trequired: "Por favor preencha o campo Matricula<br>",\n\t\t\t\t\t\tminlength: "O campo Matricula minimo de caracteres  20 <br>",\n\t\t\t\t\t\tnumber: "somente numeros <br>"\n\t\t\t\t\t},\n\t\t\t\t\ttvinculo:{\n\t\t\t\t\t\trequired: "Por favor preencha o campo Tipo de Vinculo<br>"\n\t\t\t\t\t},\n\t\t\t\t\t\n\t\t\t\t},\n\t\t\t\t\n\t\t\t\t//Monta a mensagem em uma caixa separada\n\t\t\t\terrorLabelContainer: $('#mensagens')\n\t\t});\n\t\t\n\t\t jQuery.validator.addMethod('selectcheck', function (value) {\n        return (value != '0');\n    }, " Vinculo Beneficiario");\n\t\t\n\t});\n\t</script>\n\t\n\t\n</head>\t\n\n<body>\n\t\n\t<div id="mensagens" class="classErro"></div>\n\n\t<div>\n\t\t\n\t\t<form class="cmxform" id="commentForm" method="get" action="">\n\t\t\t<fieldset>\n\t\t\t\t<p>\n\t\t\t\t\t<label for="rd-sexo">Tipo Vinculo</label><br>\n\t\t\t\t\t<label>Titular</label><input id="tvinculo" type="radio" name="tvinculo" value="1" /><br>\n\t\t\t\t\t<label>Dependente</label><input id="tvinculo" type="radio" name="tvinculo" value="2" />\n\t\t\t\t\t\n\t\t\t\t</p>\n\t\t\t\t\n\t\t\t\t<p>\n\t\t\t\t\t<label for="name">Nome Beneficiario: </label>\n\t\t\t\t\t<input id="name" name="name" type="text" >\n\t\t\t\t</p>\n\t\t\t\t\n\t\t\t\t<p>\n\t\t\t\t\t<label for="cpf">CPF:</label>\n\t\t\t\t\t<input id="cpf" type="cpf" name="cpf">\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\t<label for="nmat">Numero Matricula:</label>\n\t\t\t\t\t<input id="nmat" name="nmat" />\n\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\n\t\t\t\t<p>\n\t\t\t\t\t<label>Vinculo Beneficiario:  </label>  <span>*</span>\n\t\t\t\t\t<div class="">\n\t\t\t\t\t\t<select name="tipoBeneficiario">\n\t\t\t\t\t\t\t<option value="0">Selecione</option>\n\t\t\t\t\t\t\t<option value="1">Esposa</option>\n\t\t\t\t\t\t\t<option value="2">Filho</option>\n\t\t\t\t\t\t\t<option value="3">Mãe/Pai</option>\n\t\t\t\t\t\t\t<option value="4">Compannheira(o)</option>\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</div>  \n\t\t\t\t</p>\n\t\t\t\t\n\t\t\t\t<p>\n\t\t\t\t\t<input class="submit" type="submit" value="Submit">\n\t\t\t\t</p>\n\t\t\t\t\n\t\t\t\t\n\t\t\t</fieldset>\n\t\t</form>\n\t</div>\n\n</body>\n\n</html>\n
\n
", "tags": [{"absolute_url": "/public/tag/javascript/", "id": 7, "name": "javascript", "resource_uri": "/api/public/tag/7/", "snipts": "/api/public/snipt/?tag=7"}, {"absolute_url": "/public/tag/html/", "id": 67, "name": "html", "resource_uri": "/api/public/tag/67/", "snipts": "/api/public/snipt/?tag=67"}, {"absolute_url": "/public/tag/jquery_4/", "id": 14772, "name": "Jquery", "resource_uri": "/api/public/tag/14772/", "snipts": "/api/public/snipt/?tag=14772"}, {"absolute_url": "/public/tag/validation_1/", "id": 45837, "name": "Validation", "resource_uri": "/api/public/tag/45837/", "snipts": "/api/public/snipt/?tag=45837"}], "title": "Script com Jquery Validation ", "user": {"absolute_url": "/alexjosesilva/", "email_md5": "aeee1adb46d99d6d54bb7b0d325a259f", "id": 18522, "resource_uri": "/api/public/user/18522/", "snipts": "/api/public/snipt/?user=18522", "snipts_count": 6, "username": "alexjosesilva"}}