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

    Generating Dynamic Value in <rich:fileUpload>

    SUMIT GHOSH Newbie

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