0

I have this code:

<h:form>
    <h:button value="SHOW" onclick="PF('myPanel').show()" />

    <p:dialog header="MyPanel" widgetVar="myPanel">
            <h:outputText value="Resistance to PrimeFaces is futile!" />
    </p:dialog>
</h:form>

Clicking the button only flashes the dialog -- opens and immidiatelly closes it. Also tried using JSF commandButton with same result. Using a primefaces button works as expected, so what is JSF button missing here?

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
eight
  • 339
  • 1
  • 5
  • 16
  • JSF button and commandButton submit form (and refresh page), primefaces button not (AJAX action is called). – Vasil Lukach Jan 11 '16 at 19:17
  • Learn what an `h:button` and `h:commandButton` exactly do, their differences and usage. And try to read some articles and/or Q/A about debugging. And btw a panel !=dialog and you don't **call** a dialog – Kukeltje Jan 11 '16 at 19:30
  • Possible duplicate of [Prime Faces Command Button vs. Default Command Button](http://stackoverflow.com/questions/15267958/prime-faces-command-button-vs-default-command-button) – Kukeltje Jan 11 '16 at 19:38
  • JSF is a real deep hole for ones who never worked with basic HTML/JavaScript before. I recommend you to take a JSF pause and practice a bit more with basic JTML/JS. There are good tutorials at http://htmldog.com. – BalusC Jan 12 '16 at 07:28

1 Answers1

0

use <p:commandButton> instead.

<p:commandButton value="Basic" type="button" onclick="PF('dlg1').show();" />
Josue Martinez
  • 436
  • 5
  • 14