1 Reply Latest reply on Jun 21, 2013 5:14 PM by bleathem

    Generating Dynamic Value in <rich:fileUpload>

    sumitghosh945

      I want to set the value of doneLabel attribute of rich:fileUpload dynamically,ie one message will be shown for successful upload and another message will be shown for upload failure.I have tried something like this:

       

       

                          <rich:fileUpload style="width:412px;"

                                              noDuplicate="true"

                                              fileUploadListener="#{fileUploadController.listener}"

                                              maxFilesQuantity="#{fileUploadController.uploadsAvailable}"

                                              id="upload" immediateUpload="#{fileUploadController.autoUpload}"

                                              acceptedTypes="#{fileUploadController.supportedTypes}"

                                               listHeight="182px" doneLabel="#{fileUploadController.uploadDoneLabel}"

                                               immediate="true">

                                             <a4j:ajax event="uploadcomplete" render="uplodedFileTable"

                                                oncomplete="if(#{fileUploadController.error}){#{rich:component('errorPopup')}.show();}" />

                         </rich:fileUpload>

       

      where doneLabel is a instance field of fileUploadController bean,the bean is is Session scope.and I have given getter and setter for this field.specified condition like this:

       

       

      public void listener(FileUploadEvent event) throws Exception {

        uploadDoneLabel="";

      if(item != null ){

      ........ //other codes goes here

      .......

      uploadDoneLabel="File Uploaded Successfully";

         }

      else{

            uploadDoneLabel="Upload Failed";

      }

      }

       

       

      but it is not showing the proper message during uploading,sometime it is showing the default value of doneLabel ie "done".

      can anyone has any solution to this??????

        • 1. Re: Generating Dynamic Value in <rich:fileUpload>
          bleathem

          Are you saying the "doneLabel" is being displayed when the upload results in a failure?  Have you tried setting the "serverErrorLabel"?

           

          The label's weren't designed to be dynamic, you'll likely have a tough time getting this going.  What about using a rich:message or rich:notify to communicate with the user?