0

I'm using PrimeFaces 5.3 with the following code:

   <p:dialog id="dlg1" appendTo="@(body)" header="Confirm Dialog" widgetVar="dlg1" modal="true">  
                       <h:form id="dialogform">
                        <h:outputText id="confirmlabel" value="Are you Sure you want to  #{reportRunnerNamedBean.currentCommand} ?" />  
                        <br/>
                        <center>
                            Check to send only missed emails:<p:selectBooleanCheckbox id="sendOnlyMissedBox" value="#{reportRunnerNamedBean.sendMissedOnly}"></p:selectBooleanCheckbox><br/>   
                            <p:commandButton  id="yesButton"  value="Yes"   action="#{reportRunnerNamedBean.runCurrentCommand()}"  onstart="startWait();PF('waitDialog').show();" oncomplete="PF('waitDialog').hide();stopWait();" onclick="PF('dlg1').hide();" process="@form"/>
                            <p:commandButton  id="noButton"  process="@this" value="No"    onclick="PF('dlg1').hide();"/>

                        </center>

                       </h:form>
                    </p:dialog>

No matter what, the backing bean value for the sendMissedOnly is set to false. I have confirmed this by attaching a debugger. I have even tried adding ajax to the box, it is still false every time, no matter if it is checked or not. Does p:selectBooleanCheckbox just not work in a dialog?

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
Rhino
  • 101
  • 8

1 Answers1

0

I figured this out. It was because the dialog was in an form. It seems that when a dialog is in a form , and you have a form within the dialog itself, the component will not be processed. It seems JSF/primefaces does not like multiple layers of forms or dialogs defined within forms. If you are having a similar issue, makes sure your dialog is defined outside any form. Moving a dialog can cause paths to components to change. the easiest way to resolve that is to use the primefaces handy p:component tag like this update=":#{p:component('compoment_name')}" > that will make it find it no matter where in the tree the component occurs.

Rhino
  • 101
  • 8
  • Please, always, always, always create a [mcve]. In doing so, you either find the cause of problems or make it easier for others to help – Kukeltje Aug 26 '16 at 04:48
  • It was not a JSF problem. It was a basic HTML problem. I recommend taking a JSF pause and learning basic HTML first. – BalusC Aug 26 '16 at 05:39
  • Thank you for answering. I don't need a basic html class. I was editing in several large projects while also filling my role as system administrator, network administrator, manager and database administrator. I saw a problem , posted a question , then figured it out. I had an error in my syntax that is true and while it may not have been a jsf problem I saw the issue and fixed it a few minutes later. I fail to see how posting comments that do not answer the question but instead posting passive aggressive comments achieves anything. Thank you again for your comment. – Rhino Aug 28 '16 at 23:53