title: Primefaces Dialog box - show it conditionally. javascript code not working
body: <p>I want to show a dialog box on the click of a primefaces commandbutton. Before the dialog box , I need to check a condtional. </p>
  
  <p>I am using Spring web-flow 2.3.0.</p>
  
  <p>So I am doing it like this ,</p>
  
  <p>And the Dialog Box is </p>
  
  <p>I am not able to show this dialog box based on this condition. </p>
  
  <p>Please help me ,any pointers?</p>
  
  <p><strong>SWF 2.3.0 Primefaces 2.2.1 JSF 2 Spring Security 3 Spring 3.1.0M1I EhCache Apache Tomcat 6.0 STS 2.5.1</strong></p>
  
  <p>So I have changed my code as per below </p>
  
  <pre><code>                    &lt;p:commandLink id="addRequest" immediate="true" value="addreq"
                      oncomplete="dlg3.show()" update="dialogPanel"&gt;
                      &lt;f:setPropertyActionListener
                          value="#{searchHandler.selectedAccIns}"
                          target="#{reqSearchHandler.checkAccStatus}" /&gt;
                  &lt;/p:commandLink&gt;
  </code></pre>
  
  <p>And the dialog box is </p>
  
  <pre><code>                &lt;p:outputPanel id="dialogPanel"
                  rendered="#{not reqSearchHandler.accStatusFlag}"&gt;
                  &lt;p:dialog header="Effect Dialog" widgetVar="dlg3"
                      showEffect="bounce" hideEffect="explode" height="200"&gt;
                      &lt;h:outputText
                          value="Account is #{searchHandler.selectedAccIns.accStatusDesc}" /&gt;
                      &lt;h:outputText value="Do you want to continue?" /&gt;
                      &lt;div align="left"&gt;
                          &lt;p:commandButton value="Yes" action="accept" /&gt;
                          &lt;p:spacer width="960" height="5" /&gt;
                          &lt;p:commandButton value="No" action="cancel" /&gt;
                      &lt;/div&gt;
                  &lt;/p:dialog&gt;
              &lt;/p:outputPanel&gt;
  </code></pre>
  
  <p>But when I am clicking on the command link , I am getting 3 dialog boxes. Can you please tell me why it is so?</p>