I have a form in JSF 2.0 whose input fields have validation checks and there is a submit button. Right now when I click on the submit button I get an alert box (generated by JS) saying that my report order is being processed (to give a feedback to the user). This alert box is displayed without the neccessary validation checks for the input fields. I can do the validation check in the back bean but how can I replace the behaviour of my alert box? Can I trigger a JS action from back bean? I spent quite a lot time in web searching for a solution to this problem. If anyone has any reccommendation about which way to proceed, I will be happy to listen. Thanks in advance.
I am already doing the validation in JSF. I just want to display an (like you do with JS) alert box to say that "The report is being generated" after the validation if everything is fine. How can I do that?
Deniz Atak wrote:do you mean an ajax call after the button click?
No, he means do an AJAX call ON the button click.
In other words, override the normal "action=" method, which is non-AJAX by defining something like this:
onsubmit="ajaxSubmit(); return false;"
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Jun 29, 2011
thanks for your detailed answer. I tried adding f:ajax tag (because my component library is a little bit old - Woodstock, and I couldn't find enough documentation about Ajax support of Woodstock). But I got:
message. But my project is JSF 2.0. Isn't there a support for Ajax in JSF 2.0?