Created
September 9, 2014 17:08
-
-
Save bytefade/79565d7cd2fa5bcbc726 to your computer and use it in GitHub Desktop.
Calltest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Formulário de adesão validar | |
$('#formulario_adesao').validator().bind('onFail', function(e,errors){ | |
var primeiroImput = false; | |
if ('submit' == e.originalEvent.type) { | |
$.each(errors, function() { | |
var input = this.input; | |
switch (input.attr('name')){ | |
case 'idplano': | |
$('#div-valor_titular').css('display', 'block'); break; | |
case 'concodar_plano': $('#div-concodar_plano').css('display', 'block'); | |
$('#concodar_plano').css('outline-color', 'red'); | |
$('#concodar_plano').css('outline-style', 'solid'); | |
$('#concodar_plano').css('outline-width', 'thin'); | |
break; | |
case 'forma_pagamento_odonto': $('#forma_pagamento_odonto_debito').css('display', 'block'); | |
$('#forma_pagamento_odonto').css('outline-color', 'red'); | |
$('#forma_pagamento_odonto').css('outline-style', 'solid'); | |
$('#forma_pagamento_odonto').css('outline-width', 'thin'); | |
break; | |
default: | |
if (primeiroImput){}else{ | |
primeiroImput = input; | |
} | |
input.css({border:'1px solid red'}).focus(function(){ | |
input.css({border:'1px solid #abadb3'}); | |
}); | |
} | |
}); | |
alert("Os campos destacados em vermelho precisam ser preenchidos."); | |
if (primeiroImput) { | |
primeiroImput.focus(); | |
} | |
} | |
return false; | |
}); | |
//se formulário passar | |
$('#formulario_adesao').validator().bind('onSuccess', function() { | |
/* travar botao */ | |
$('#btn_conc_proposta').attr({ | |
'disabled': true, | |
'value': 'Por favor, aguarde enquanto processamos sua proposta.' | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment