I'm having a problem with the p:commandButton component... I have 2 kinds of buttons (ajax=true and ajax=false) and i want to create a "loading stage" for them. When the buttons are clicked they should be disabled and a loading image should appear.
I have no problems with the loading image, my problem is with the disabled buttom. It works fine when "ajax=true", i click it, the method is called and i get everything right, but when "ajax=false" the method is not called, the page is just reloaded.
I could make a workaround using oncomplete="window.location('myurl')", but it's not very cool and it would disable my messages (the messages threw by the method called) at the next page.
My code is the following:
Code: Select all
<div style="float: left" >
<p:commandButton value="Salvar" action="#{GrupoController.salvar}" widgetVar="salvar" ajax="false" onclick="setVisible('loading'); salvar.disable()" />
</div>
<div id="loading" style="margin-left:235px; padding-top:7px; visibility: hidden">
<comp:ajax_loading ajaxListener="false" />
</div>
Thanks in advance.