Advertisement
EvaldoMaciel

beforeSendValidate

Jul 16th, 2021
957
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.         var beforeSendValidate = function (numState, nextState) {
  3.             var mensagem = "<ul>";
  4.             if (numState == 0 || numState == 2 || numState == 1) {
  5.  
  6.                 var tipoProduto = $("[name='tipoProduto']:checked").val();
  7.  
  8.                 if (campoVazio($("[name*='tx_responsavelDisponibilizacao']").val())) {
  9.                     mensagem += "<li>O campo \"Resp. Disponibilização (Responsável pelo Evento)\" é obrigatório!</li>";
  10.                 }
  11.  
  12.                 if ($("input[type='checkbox'][id*='ck_aproveitamento']").is(":checked")) {
  13.                     if (campoVazio($("#nb_notaMinima").val())) {
  14.                         mensagem += "<li>O campo \"Nota Mínima\" é obrigatório!</li>";
  15.                     }
  16.                 }
  17.  
  18.             }
  19.             if (mensagem.length > 10) {
  20.                 throw (mensagem + "</ul>");
  21.             }
  22.         };
  23.  
  24.         function campoVazio(params) {
  25.             if (String(params) == "" || String(params) == null) {
  26.                 return true;
  27.             }
  28.             return false;
  29.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement