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

    rich:fileUpload in rich:modalPanel

    Dmitry Shultz Novice

      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
          Alexey Kakunin Newbie

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

          • 2. Re: rich:fileUpload in rich:modalPanel
            Dmitry Shultz Novice

            redesigned it as well ...

            • 3. Re: rich:fileUpload in rich:modalPanel
              Andrei Markavtsov Apprentice

              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
                John Pount Newbie

                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 ????


                <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:modalPanel id="panel" width="800" height="350">
                <h:panelGrid columns="2" columnClasses="top,top">
                <rich:fileUpload id="upload" fileUploadListener="#{personController.fileUploader.listener}"
                acceptedTypes="jpg, gif, png, bmp">
                <a4j:support event="onuploadcomplete" reRender="info" />
                <h:panelGroup id="info">
                <rich:panel style="height:250px;width:350px;">
                <f:facet name="header">
                <h:outputText value="Uploaded Files Info" />
                <h:outputText value="No files currently uploaded"
                rendered="#{personController.fileUploader.size==0}" />
                <rich:dataGrid columns="1" value="#{personController.fileUploader.files}" var="file" rowKeyVar="row">
                <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"/>
                <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}" />
                <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"
                <rich:componentControl for="panel" attachTo="keepPhotoButton" operation="hide" event="onclick"/>


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

                • 5. Re: rich:fileUpload in rich:modalPanel
                  Kerdudou Ronan Apprentice

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