Fileupload in popupPanel?!?
sebastian_goetz Dec 9, 2011 3:43 AMHi there,
I tried to use a fileupload component inside a popupPanel with no success. My fileupload listener method in the backing bean gets never called. If I move the fileupload component out of the popupPanel into the default visible page area, it works smooth. Since I am not very familiar with richfaces I may have missed something I guess. But what??
Here are the major parts of the code:
<ui:define name="content"> <h:form> <rich:toolbar style="width:100%;"> <rich:toolbarGroup> <h:commandButton value="#{messageSource['lbl_doNew']}" action="#{projectCardParameterBean.doNew}"/> <h:commandButton value="#{messageSource['lbl_doEdit']}" action="#{projectCardParameterBean.doEdit}" rendered="#{not empty projectCardParameterBean.projectCardParameter and not projectCardParameterBean.projectCardParameter.transient}"/> <h:commandButton value="#{messageSource['lbl_doImport']}"> <rich:componentControl target="popup" operation="show" /> </h:commandButton> <rich:popupPanel id="popup" modal="true" style="text-align:center;" onmaskclick="#{rich:component('popup')}.hide()" width="500" height="180" minHeight="180"> <f:facet name="header"> <h:outputText value="#{messageSource['lbl_selectImportFile']}" /> </f:facet> <f:facet name="controls"> <h:outputLink value="#" onclick="#{rich:component('popup')}.hide(); return false;">#{messageSource['lbl_doClose']}</h:outputLink> </f:facet> <h:panelGrid columns="1" style="width:100%; height:120px;"> <rich:fileUpload id="ParameterUpload" addLabel="#{messageSource['lbl_doSelect']}" clearAllLabel="#{messageSource['lbl_doClearAll']}" clearLabel="#{messageSource['lbl_doClear']}" deleteLabel="#{messageSource['lbl_doDelete']}" doneLabel="#{messageSource['lbl_done']}" serverErrorLabel="#{messageSource['lbl_serverError']}" sizeExceededLabel="#{messageSource['lbl_sizeExceeded']}" uploadLabel="#{messageSource['lbl_doStart']}" fileUploadListener="#{projectCardParameterBean.processFileUpload}" acceptedTypes="xml" style="width:100%; height:90px;"> <a4j:ajax event="uploadcomplete" execute="@none" render="import" /> </rich:fileUpload> <rich:message for="ParameterUpload" id="ParameterUploadMsg" showDetail="true" ajaxRendered="true"/> <h:commandButton id="import" value="#{messageSource['lbl_doImport']}" onclick="#{rich:component('popup')}.hide();" action="#{projectCardParameterBean.doImport}" rendered="#{not empty projectCardParameterBean.importFile}"/> </h:panelGrid> </rich:popupPanel> </rich:toolbarGroup> <rich:toolbarGroup style="width:100%"> <outputText value=""/> </rich:toolbarGroup> <rich:toolbarGroup location="right"> <rich:autocomplete id="ajaxSearch" mode="cachedAjax" minChars="1" autocompleteMethod="#{projectCardParameterBean.autocomplete}" autofill="true" var="pcp" fetchValue="#{pcp.name}" immediate="true" layout="grid" value="#{projectCardParameterBean.searchPhrase}" onkeypress="return event.keyCode != 13;" onselectitem="#{rich:element('ajaxSearchButton')}.focus();"> <h:outputText value="#{pcp.name} #{prm:enclose(pcp.projectType, '(', ')')}" /> <rich:tooltip mode="client" followMouse="false" showDelay="700" layout="block"> <h:outputText value="#{messageSource['tip_ajaxSearch']}"/> </rich:tooltip> </rich:autocomplete> <h:commandButton id="ajaxSearchButton" value="#{messageSource['lbl_doShow']}" action="#{projectCardParameterBean.doSearch}"/> </rich:toolbarGroup> </rich:toolbar> ...
Regards,
Sebastian