popupPanel calling Bean
trigun Feb 18, 2012 1:33 PMHi all,
I have the following setup on my Page:
popupPanels.xhtml which includes the following popups:
<h:panelGroup id="popupPanels" layout="block" style="display: none;">
<ui:include src="/misc/registerPopup.xhtml" />
<ui:include src="/misc/statusPopup.xhtml" />
<ui:include src="/misc/createAlbumPopup.xhtml"/>
</h:panelGroup>
then in the template.xhtml of my Page i unclude all Popups by <ui:include src="/misc/popupPanels.xhtml"/> so they are allways available.
Now i have a problem with registerPopup:
<rich:popupPanel id="registerPopup" width="500" height="600" resizeable="false"
autosized="true" onshow="#{rich:element('usernameReg')}.focus()">
<h:form id="registerForm">
<rich:graphValidator id="regVal">
<rich:panel id="createUserPanel" >
<h2 style="color:#0E385F;">#{msgBv['createBenutzer.titel']}</h2>
<p/>
<h:panelGrid id="regGrid" columns="2" >
<h:outputLabel for="usernameReg" value="#{msgBv['createBenutzer.benutzername']}"/>
<h:inputText id="usernameReg" value="#{reg.newUser.username}">
<a4j:ajax event="change" listener="#{reg.usernameExists}" render="createUserPanel"/>
</h:inputText>
<h:outputLabel for="nachname" value="#{msgBv['createBenutzer.nachname']}"/>
<h:inputText id="nachname" value="#{reg.newUser.nachname}" styleClass="inputtext" />
....................
....................
reg.newUser.username points to a @ConversationScoped Bean. The problem now is that my Bean gets initialized on Page load alltough i don`t call the Popup to show ?!
I want to show the popup on click of the register button and init the conversation there:
<a4j:commandButton value="#{msgBv['benutzer.register']}" rendered="#{not auth.loggedIn}"
actionListener="#{reg.init}" oncomplete="#{rich:component('registerPopup')}.show(); "
render="createUserPanel"/>
How can i prevent the Rigister bean to be loaded until i show the register popup ?
Thank you