Question: I have a button and a panel in primefaces. I want the panel to be visible when I press the button. How can I do it with primefaces?

I have the code

```
        <p:commandButton value="Search" ajax="false"
        actionListener="#{myBean.searchPatients}" onclick="panelwv.show();">
    </p:commandButton>
    <p:panel widgetvar="panelwv" visible="false" closable="true" toggleable="true" >

```

but it does not work

Answer: 
You have a typo in your code, the attribute you need is `widgetVar`:

```
<p:commandButton value="Search" ajax="false"
    actionListener="#{myBean.searchPatients}" onclick="panelwv.show();">
</p:commandButton>
<p:panel widgetVar="panelwv" visible="false" closable="true" toggleable="true"/>

```

If you don't want to render your panel at all you should consider using the `rendered` attribute of the component.
You can use dialog for this . You can also examine this 

<https://www.primefaces.org/showcase/ui/overlay/dialog/basic.xhtml>

```
<p:commandButton value="Search" ajax="false"
actionListener="#{myBean.searchPatients}" oncomplete="PF('dlg1').show();">
</p:commandButton>
<p:dialog header="Basic Dialog" widgetVar="dlg1" minHeight="40">
<p:panel  visible="false" closable="true" toggleable="true"/>
</p:dialog>

```