4 Replies Latest reply on Aug 6, 2009 5:12 AM by ilya_shaikovsky

    FileUploadListener not fired

      Hi!

      I have a problem with the fileupload component: when adding a file the fileuploadlistener isnt invoked anymore.

      It has been working this morning.. it has nothing to do with something in the web.xml (I reverted all changes there).

      The only change that i see right now is that i removed the 4 or 5 forms in the modal panel, and did a big one all around instead. (which i did to be able to use the a4j:support on the modal panel, so im reluctant to change it again)

      After 3 days of trying this and that to get this and that going its all pretty messed up i guess, but anyway, here is the code:

      <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core" version="2.0"
       xmlns:t="http://myfaces.apache.org/tomahawk"
       xmlns:c="http://java.sun.com/jsp/jstl/core"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:a4j="http://richfaces.org/a4j">
       <ui:composition>
       <t:div>
       <h:form id="uploadForm">
       <rich:modalPanel id="uploadPanel" width="450" height="600">
       <a4j:support event="onshow"
       actionListener="#{pollerBean.activateUploadStatusPoller}"
       immediate="true"
       reRender="uploadPoller,uploadProgress,concludeUpload" />
       <a4j:support event="onbeforehide"
       actionListener="#{pollerBean.deactivateUploadStatusPoller}"
       immediate="true"
       reRender="uploadPoller,uploadProgress,concludeUpload" />
       <f:facet name="header">
       <h:outputText value="#{res.upload_title}"></h:outputText>
       </f:facet>
       <f:facet name="controls">
       <h:panelGroup>
       <h:graphicImage
       value="/images/Crystal_Clear_action_button_cancel.png"
       style="cursor:pointer; width:15px; height:15px;"
       id="hidelinkupload" />
       <rich:componentControl for="uploadPanel"
       attachTo="hidelinkupload" operation="hide" event="onclick" />
       </h:panelGroup>
       </f:facet>
       <t:div>
       <t:div>
       <t:div>
       <rich:fileUpload disabled="#{uploadBean.fedoraUploadStarted}"
       addControlLabel="select File.." listHeight="120px"
       id="richfaces_fileupload" acceptedTypes="zip"
       immediateUpload="true" immediate="true"
       uploadData="#{uploadBean.uploadedFileItems}"
       fileUploadListener="#{uploadBean.uploadFile}"
       maxFilesQuantity="1">
       <a4j:support immediate="true"
       actionListener="#{uploadBean.enableUploadButton}"
       event="onfileuploadcomplete" reRender="uploadZipOk" />
       <a4j:support immediate="true"
       actionListener="#{uploadBean.clearList}" event="onclear"
       reRender="richfaces_fileupload,uploadZipOk" />
       </rich:fileUpload>
       </t:div>
       <t:div styleClass="formcontent1">
       <t:div styleClass="central">
       <t:commandButton
       disabled="#{empty uploadBean.uploadedFileItems}"
       id="uploadZipOk" value="#{res.upload_upload}"
       action="#{uploadBean.uploadToFedora}">
       <a4j:support event="onclick"
       actionListener="#{uploadBean.disableUpload}"
       reRender="richfaces_fileupload" immediate="true" />
       </t:commandButton>
       </t:div>
       </t:div>
       </t:div>
       <t:div
       style="overflow: scroll; height:400; margin-left:10px; float: left;">
       <a4j:poll id="uploadPoller" interval="1000"
       enabled="#{pollerBean.pollUploadStatus}"
       reRender="uploadPoller,uploadProgress,concludeUpload" />
       <h:outputLabel value="Progress:"></h:outputLabel>
       <rich:dataTable width="400" id="uploadProgress" var="part"
       value="#{uploadBean.fedoraUploadObjects}">
       <rich:column>
       <f:facet name="header">
       <h:outputText value="name"></h:outputText>
       </f:facet>
       <h:outputText value="#{part.name}"></h:outputText>
       </rich:column>
       <rich:column>
       <f:facet name="header">
       <h:outputText value="status"></h:outputText>
       </f:facet>
       <h:outputText value="#{part.status}"></h:outputText>
       </rich:column>
       <rich:column>
       <a4j:commandButton disabled="#{!part.failed}" value="retry"
       action="#{part.retry}">
       </a4j:commandButton>
       </rich:column>
       </rich:dataTable>
       </t:div>
       <t:div styleClass="formcontent1">
       <t:div styleClass="central">
       <t:commandButton id="concludeUpload"
       disabled="#{!uploadBean.done}"
       value="#{res.upload_concludeUpload}"
       action="#{uploadBean.acceptUpload}">
       </t:commandButton>
       </t:div>
       </t:div>
       </t:div>
       </rich:modalPanel>
       </h:form>
       </t:div>
       </ui:composition>
      </jsp:root>


      Richfaces Version is 3.3.1

      perhaps anyone has an idea whats wrong?

        • 1. Re: FileUploadListener not fired
          ilya_shaikovsky

          use domElementAttachment with form value. in other case - you have to use form inside the modal and not around it. check docs.

          • 2. Re: FileUploadListener not fired

            I did check the docs - theyre kind of not helping ;)

            I cant put the form inside of the modal panel, because the support is then on the form, not on the panel.

            and what do you mean by domElementAttachment?

            • 3. Re: FileUploadListener not fired

              ah.. that belongs to the modal panel, ok ill read it through, thanks.

              • 4. Re: FileUploadListener not fired
                ilya_shaikovsky

                1)


                I did check the docs - theyre kind of not helping ;)

                you need to re-check if not seen the note about forms and modal panel.

                2) domElement attribute of modal panel.

                3)
                <t:commandButton disabled="#{empty uploadBean.uploadedFileItems}"
                value="#{res.upload_upload}"
                action="#{uploadBean.uploadToFedora}">
                <a4j:support event="onclick" actionListener="#{uploadBean.disableUpload}" reRender="richfaces_fileupload" immediate="true" />
                </t:commandButton>
                


                you really need two requests there? ;)