Pessoal, como consigo colocar campos tipos "zoom" como obrigatório no script abaixo?
<script type="text/javascript" charset="utf-8">
var textosAlertas = [];
var alert ='<h4><b>Campo(s) obrigatório(s) não preenchido(s):</b></h4>';
textosAlertas['nm_nome']='=> Nome';
textosAlertas['vl_telefone']='=> Telefone';
textosAlertas['vl_idade']='=> Idade';
textosAlertas['cb_sexo']='=> Sexo';
textosAlertas['vl_cep']='=> CEP';
textosAlertas['nm_cidade']='=> Cidade';
textosAlertas['nm_lougradouro']='=> Lougradouro';
textosAlertas['nm_complemento']='=> Complemento';
textosAlertas['nm_bairro']='=> Bairro';
textosAlertas['nm_estado']='=> Estado';
textosAlertas['zoom_Func']='=> Lista de Funcionários';
textosAlertas['cb_formacao']='=> Formação Escolar';
textosAlertas['zoom_Area']='=> Possível área de atuação';
textosAlertas['zoom_Profissoes']='=> Possíveis Profissões';
var beforeSendValidate = function(numState, nextState) {
var camposObrigatorios = new Array();
/* Limpa campos que estavam com erro da validação anterior */
$(".has-error").removeClass("has-error");
$(".has-free").each(
function() {
var tag = $(this).prop("tagName");
switch (tag) {
case "INPUT":
var tipo = $(this).prop("type");
if (tipo == "radio") {
var checado = $("[name='"+ $(this).prop("name") + "']:checked");
if(checado.length == 0){
if(camposObrigatorios.indexOf($(this).prop("name")) < 0){
camposObrigatorios.push($(this).prop("name"));
$(this).closest(".radio").addClass("has-error");
}
}
} else if (tipo == "checkbox") {
if ($(this).checked == false) {
camposObrigatorios.push($(this).prop("name"));
$(this).closest(".form-group").addClass("has-error");
}
} else {
switch ($(this).prop("id")){
case "zoom_Func":
if($("#cb_ProRet").val() == "S"){
if ($(this).val() == ""){
camposObrigatorios.push($(this).prop("name"));
$(this).closest(".form-group").addClass("has-error");
}
}
break
default:
if ($(this).val() == ""|| $(this).val() == 'mm/dd/yyyy'|| $(this).val() == 'dd/mm/aaaa'){
camposObrigatorios.push($(this).prop("name"));
$(this).closest(".form-group").addClass("has-error");
}
}
}
break;
case "SELECT":
if ($(this).val() == "") {
camposObrigatorios.push($(this).prop("name"));
$(this).closest(".form-group").addClass("has-error");
}
break;
case "TEXTAREA":
switch ($(this).prop("id")){
default :
if ($(this).val() == "") {
camposObrigatorios.push($(this).prop("name"));
$(this).closest(".form-group").addClass("has-error");
}
}
}
});
var txtErro ='';
if (camposObrigatorios.length > 0) {
txtErro = alert;
for ( var i = 0; i < camposObrigatorios.length; i++) {
if (textosAlertas[camposObrigatorios[i]] != '') {
txtErro += "\n" + textosAlertas[camposObrigatorios[i]];
}
}
}
console.info('TESTE');
if(txtErro!=''){throw (txtErro);}
};
</script>