So here is a problem I was running into, I usually use rich:modalpanel just to display some data to the user, but the other day I needed to collect some input. After happily submitting my page all the submitted values were null, what the hell. After some research here are my conclusions on this problem.
We need to put “form” elements inside the modalPanel in order for this to work, and make sure that the ui:insert in our template is not nested within out top form.
Reason for this is because of where modalpanel is appended to the DOM, that is also a reason why we have a4j:form inside the panel.
<ui:define name="modalForm"> <rich:modalPanel id="center_modal"> <a4j:form id="modalForm" prependId="true"> <f:facet name="header"> <h:outputText value="Center Selection" /> </f:facet> <f:facet name="controls"> <h:graphicImage value="/images/close.png" style="cursor:pointer" onclick="Richfaces.hideModalPanel('center_modal')" /> </f:facet> CONTENT HERE </a4j:form> </rich:modalPanel> </ui:define>
Using Facelets and JSF 1.2