5 Replies Latest reply on Jul 15, 2008 4:30 AM by ronanker

    rich:fileUpload in rich:modalPanel

    zeppelinux

      I copy pasted two classes (File.java and FileUploadBean.java) from RichFaces demo and using the same exact mark up from file upload demo.

      It doesn't work for me when rich:fileUpload is placed into the modalPanel, - listener is called, but everything is null in the UploadItem.
      Outside of modal panel is fine.

      Seam 2.0.2 SP1 + RichFaces 3.2.2-20080608.044237 + Facelets


        • 1. Re: rich:fileUpload in rich:modalPanel
          akakunin

          I had same problem - did not found solution - just dropped modalPanel and placed upload into normal form

          • 2. Re: rich:fileUpload in rich:modalPanel
            zeppelinux

            redesigned it as well ...

            • 3. Re: rich:fileUpload in rich:modalPanel

              Can you please provide your page code here?

              Seems you have something wrong there. Fileupload works fine with modal panel in my test invironment.

              • 4. Re: rich:fileUpload in rich:modalPanel

                I originally had this issue but fixed it by adding a form within the modal panel - see below:

                The problem I now have is that the "photoPanel" does not get re-rendered when I select a photo on the popup (see code at bottom of post). The action gets fired but reRender doesn't - do I need to qualify the call ie mainform:photoPanel ????

                Thanks,
                John

                <h:form id="mainform">
                <rich:panel id="photoPanel" styleClass="photoPanel">
                <a4j:mediaOutput style="width:220px;height:220px;" element="img" createContent="#{personController.getCurrentPhoto}" mimeType="image/jpeg"/>
                </rich:panel>
                ...
                ...
                </h:form>

                <f:subview>
                <rich:modalPanel id="panel" width="800" height="350">
                <h:form>
                <h:panelGrid columns="2" columnClasses="top,top">
                <rich:fileUpload id="upload" fileUploadListener="#{personController.fileUploader.listener}"
                maxFilesQuantity="#{personController.fileUploader.uploadsAvailable}"
                immediateUpload="#{personController.fileUploader.autoUpload}"
                acceptedTypes="jpg, gif, png, bmp">
                <a4j:support event="onuploadcomplete" reRender="info" />
                </rich:fileUpload>
                <h:panelGroup id="info">
                <rich:panel style="height:250px;width:350px;">
                <f:facet name="header">
                <h:outputText value="Uploaded Files Info" />
                </f:facet>
                <h:outputText value="No files currently uploaded"
                rendered="#{personController.fileUploader.size==0}" />
                <rich:dataGrid columns="1" value="#{personController.fileUploader.files}" var="file" rowKeyVar="row">
                <rich:panel>
                <h:panelGrid columns="2">
                <a4j:mediaOutput element="img" mimeType="#{file.mime}"
                createContent="#{personController.fileUploader.paint}" value="#{row}"
                style="width:100px; height:100px;" cacheable="false">
                <f:param value="#{personController.fileUploader.timeStamp}" name="time"/>
                </a4j:mediaOutput>
                <h:panelGrid columns="2">
                <h:outputText value="File Name:" />
                <h:outputText value="#{file.name}" />
                <h:outputText value="File Length(bytes):" />
                <h:outputText value="#{file.length}" />
                </h:panelGrid>
                </h:panelGrid>
                </rich:panel>
                </rich:dataGrid>
                </rich:panel>
                <rich:spacer height="3"/>

                <a4j:commandButton action="#{personController.fileUploader.clearUploadData}"
                reRender="info, upload" value="Clear Uploaded Data"
                rendered="#{personController.fileUploader.size>0}" />
                <a4j:commandButton action="#{personController.replacePhoto}" value="Keep Photo" id="keepPhotoButton"
                reRender="photoPanel"
                rendered="#{personController.fileUploader.size>0}"/>
                <rich:componentControl for="panel" attachTo="keepPhotoButton" operation="hide" event="onclick"/>

                </h:panelGroup>

                </h:panelGrid>
                </h:form>
                </rich:modalPanel>
                <h:outputLink value="#" id="link" rendered="#{personController.personEditable}">
                <h:commandButton value="Select Photo"/>
                <rich:componentControl for="panel" attachTo="link" operation="show" event="onclick"/>
                </h:outputLink>
                </f:subview>

                • 5. Re: rich:fileUpload in rich:modalPanel
                  ronanker

                  maybe the subview here can cause visibility problem for the rerender...