My query is as follows, I have a div teacher, where I have a form with several fields inside. The form has validations of Bootstrap inside:
$(document).ready(function() {
limpiarFormulario(frmGarantias);
limpiarFormulario(frmAsignarGarantia);
frmGarantias.bootstrapValidator({
framework: 'bootstrap',
excluded: [':disabled', ':hidden'],
fields : {
selTipoGarantia: {
validators: {
notEmpty : {
message : 'Debe seleccionar garantía.'
}
}
},
// Hipoteca
sel_tip_bie_hip: {
validators: {
callback: {
callback: function(value, validator, field) {
var val_ind_garantia = $('#hid_ind_garantia').val();
var val_cod_tip_garantia = $("#selTipoGarantia").val();
if (val_cod_tip_garantia == '01' && // Hipoteca
val_ind_garantia != '3') {
if (esnulo(value)) {
return { valid: false, message: 'Debe seleccionar Tipo de bien.'}
}
return true;
}
}
}
}
},
// Generico Descripcion
txt_dir_des_obs_hip: {
validators: {
callback: {
callback: function(value, validator, field) {
var val_ind_garantia = $('#hid_ind_garantia').val();
var val_cod_tip_garantia = $("#selTipoGarantia").val();
if (val_cod_tip_garantia == '01' && // Hipoteca
val_ind_garantia != '3') {
if (esnulo(value)) {
return { valid: false, message: 'Debe ingresar Descripción.'}
}
}
if (value.length > 400 && val_ind_garantia != '3') {
return { valid: false, message: 'El valor ingresado debe tener menos 400 caracteres.'}
}
return true;
}
}
}
}
}
});
});
My initial logic is that when loading my JSP page save the content of the master div in a hidden
element.
$('#hid_con_gar_html').val($('#frm-garantia').html());
My final logic is then to delete the content of the master div and restore it with the initial content that is in hidden
.
$('#frm-garantia').html($('#hid_con_gar_html').val());
My problem is that when I need to use the form again, the Bootstrap validations are lost. I hope you can help me with my problem.
Greetings.