0

I am new in Primefaces, and I encountered this problem. The action can not be performed unless I move onclick tag.

    <p:commandButton value="Détail " action="#{Allcar.gethistorique}" onclick="detail();suppcar.disable();modifscar.disable();comptecar.disable();detcar.disable()"
        id="deta" widgetVar="detcar" disabled="true">
</p:commandButton>
halfer
  • 19,824
  • 17
  • 99
  • 186
Wadii Slatnia
  • 183
  • 1
  • 4
  • 10
  • Do you need the javascript in the onclick to happen before or after the jsf action? – zargarf Jun 14 '13 at 16:07
  • Why are you disabling the button if you want to be able to click it? If you want to run javascript before the jsf action, then use onstart="your code". If you want to run javascript after the jsf action then use oncomplete=" your code" – zargarf Jun 14 '13 at 16:10
  • I want to run the action then onclick and after I want that the button becomes not clickable – Wadii Slatnia Jun 14 '13 at 16:18

1 Answers1

0

You have the commandButton initially set to disable="true". It won't submit if disabled. If you leave out the disabled="true", it works for me (though I am only using the detcar.disable() in the onclick)

<p:commandButton value="Détail " action="#{Allcar.gethistorique}" onclick="detcar.disable()"
            id="deta" widgetVar="detcar">
    </p:commandButton>
zargarf
  • 633
  • 6
  • 18
  • #6 in https://stackoverflow.com/questions/2118656/commandbutton-commandlink-ajax-action-listener-method-not-invoked-or-input-value – Kukeltje Feb 04 '19 at 21:51