0
I have a screen that asks for cnjp, dtini and dtfim, status and a query button. In javascript, the query function calls another function that validates the fields. If the fields are ok, a table with the above mentioned data is Visible. However, the query button is a Submit, so it updates the page, going back to its initial state which is the Hidden table. Is there any way I can make this rule using my bean with some primefaces component where I can make an if?
function Consultar() {
if (Valida()) {
with (document.frmConsSolicAltDomicBanc) {
var hdnAcaoBotao = document
.getElementById("frmConsSolicAltDomicBanc:hdnAcaoBotao");
hdnAcaoBotao.value = "C";
document.getElementById("table1").style.display = "block";
action = "#{ConssolicaltdomicBancBean.lista()}";
submit();
}
}
}
Above my function checking if the data is ok. I’m open to new ideas on how to implement this rule.
with Javascript you can put a
preventDefault()
on the button click like this.. you can perform an action before making the form Submit!– wDrik
Ever tried putting a
event.preventDefault();
right there before your var?– hugocsl
I thought about putting an Event.preventDefault(); but I’m stuck on how to call Submit again. Could you give me an example?
– Dan Araújo