I created this confirm:
<script type="text/javascript" language="javascript">
function salvarAntes(){
var r=confirm("Deseja confirmar?");
if(r){
return true;
} else {
return false;
}
}
</script>
And I call my commandButton:
<p:commandButton value="Confirma" process="@form" onclick="if(salvarAntes() #{bean.salvar});"/>
The idea is to call the method in the bean only if the my javascript is true. The problem is that onclick says that it does not find the method. Does anyone know how I can resolve?