0

I have a simple jsf form with a button that is supposed to trigger a method call on the backing bean

<h:form id="form">
    <h:commandButton id="button" value="Submit" action="#{controller.submit}"
             onComplete="promptSuccess('Changes submitted successfully')" />
</h:form>

Everytime I press that button, the page refreshes and the JavaScript function 'promptSuccess' never even gets called.

I would like the form to be updated and also the success function be called as soon as the changes have been submitted. But the whole page gets refreshed.

I did see a few examples on SO but none of them proved useful to my particular problem/situation.

I would really appreciate some help on this.

Examples referred to:

Example_1

Example_2

Nick Div
  • 5,338
  • 12
  • 65
  • 127
  • Possible duplicate of [Execute JavaScript before and after the f:ajax listener is invoked](https://stackoverflow.com/questions/24912335/execute-javascript-before-and-after-the-fajax-listener-is-invoked) – Kukeltje Jun 10 '18 at 06:27
  • You **should** use ajax like in the first example you posted and then read the duplicate – Kukeltje Jun 10 '18 at 06:28

0 Answers0