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'm validating with script above, however you can see that I'm validating 4 fields that can not be null.
First test:
As soon as I open the form I submit submit to see if it is working, however in my DOM it is only rendered still patient_input and progama_input, so far worked perfectly if it has null it correctly execute the script.
ButtheothertwofieldsarerenderedwhenIfillintheprogama_inputfield,donethiswhenI'mgoingtotestifgroupandattendanceisnullblockthesubmitjsfdoesaredirecttothesamepageandstillcomesbackwiththefollowingerrorintheconsole.
Noticeintheimagebelowthatgroupisnowaccessible.
WhenIsubmitagaintotestthenullofthegroupinput,jsfdoesaredirectandreturnsthat.