p:commandButton - is this behavior normal?

UI Components for JSF
Post Reply
tiagoperes
Posts: 13
Joined: 15 Feb 2011, 21:25

18 May 2011, 02:03

Hi everyone,

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>
Is this behavior of p:commandButton normal, a possible bug or am i doing something wrong?

Thanks in advance.
JSF 2.1.12 + Primefaces 3.5 + Tomcat 7.0.34 + Maven 3.0.4 + Spring 3.2.2

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests