2
My validation script using bootstrapValidator.js
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
<h:outputScript library="primefaces" name="jquery/jquery-plugins.js" target="head" />
<script type="text/javascript">
$ = jQuery;
$(document).ready(function() {
$('#formAgendaMedica').bootstrapValidator({
live : 'disabled',
fields : {
'formAgendaMedica:paciente_input' : {
validators : {
notEmpty : {
message : 'Informe o paciente'
}
}
},
'formAgendaMedica:progama_input' : {
validators : {
notEmpty : {
message : 'Informe o programa'
}
}
},
'formAgendaMedica:grupo_input' : {
validators : {
notEmpty : {
message : 'Informe o grupo'
}
}
},
'formAgendaMedica:atendimento_input' : {
validators : {
notEmpty : {
message : 'Informe o atendimento'
}
}
}
}
});
});
</script>
The scenario is as follows, I open my screen that has the form that I am validating with above script, however you can see that I am validating 4 fields that cannot be null.
First test:
Once I open the form give Submit to see if it is working, but in my DOM is rendered only patient_input and progama_input, until here worked perfectly if null it execute the script correctly.
But the other two fields are rendered when I fill in the progama_input field, done this when I will test if group and service is null lock the jsf does a redirect to the same page and still comes back with the following error in the console.
Notice in the image below that group is now accessible.
When I give Submit again to test group input null jsf redirects and returns this.
I believe you don’t need the
$ = jQuery;
.– BrTkCa