I have a problem when I use the formvalidation plugin, because it does not matter if I click on the radius with value = 0 or value = 1, it keeps asking me to fill in the select field, but I only want it to do so when value = 1.
HTML
<form action="" id="Vacante"> <h3 class="page-header">Tipo de vacante</h3> <div class="row">
<div class="col-sm-12">
<label>Tipo de Vacante</label>
<br />
<input type="radio" name="Vacantes_Tipo" id="Vacantes_TipoNo" value="0" checked="checked"> Nueva Vacante <input type="radio" name="Vacantes_Tipo" id="Vacantes_TipoSi" value="1"> Vacante por rotación de personal
<hr />
<div class="form-group" id="VacanteBaja">
<label>Razón de Baja</label>
<select class="form-control" name="ddl_Vacantes_Baja" id="ddl_Vacantes_Baja" data-live-search="true">
<option value="" selected>Selecciona..</option>
<option value="1">Enfermedad</option> </select> </div>
</form>
Jquery with FormValidation
$(document).ready(function () {
$('#Vacante')
.formValidation({
excluded: ':disabled',
framework: 'bootstrap',
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
Vacantes_Tipo: {
validators: {
notEmpty: {
message: 'This field is required'
}
}
},
ddl_Vacantes_Baja: {
validators: {
notEmpty: {
message: 'This field is required'
}
}
},
qty: {
validators: {
notEmpty: {
message: 'This field is required'
}
}
}
}
})
});