1 Reply Latest reply on May 13, 2013 1:31 AM by Siva P

    <rich:fileupload> and oncomplete

    Srinivas S Newbie

      Hi,

       

              I want to upload file and show the errors in the popup panel.

              When I use the onuploadcomplete="#{rich:component('errorsId')}.show()" on < rich:fileupload/> the popup is showing without list of errors.

               But when I attached the oncomplete="#{rich:component('errorsId')}.show()"  on <a4j:commandButton/> it is working as expected and all the errros are showing in the rich:popuppanel.

              How can I acheive the same with rich:upload ?

       

       

       

      Srikanth Goud

        • 1. Re: <rich:fileupload> and oncomplete
          Siva P Master

          Hi,

           

          I have added like below for displaing errors in the oncomplete of upload file ,

           

          <rich:fileUpload   fileUploadListener="#{uploadFileBean.fileUploadListener}"

                                           maxFilesQuantity="1" 

                                          id="upload" addControlLabel="Browse...." clearAllControlLabel="Clear all"

                                          clearControlLabel="Clear" stopEntryControlLabel="Stop process" doneLabel="Success" autoclear="false"                

                                           acceptedTypes="xls,xlsx"  

                                          immediateUpload="#{uploadFileBean.autoUpload}"

                                           allowFlash="false" >

                                           <a4j:support event="onuploadcomplete" focus="upload"

                                         reRender="info,uploadinfoSuccess,uploadinfoSuccessAll,uploadinfoBoth,uploadinfoFailure,uploadinfoFailureNodata,blacklistProfileDataScroll,blacklistData"

                                          oncomplete="#{rich:component('addBlacklistUploadModal')}.show();"

                                          onbeforedomupdate="#{rich:component('addBlacklistUploadModal')}.show();"/>                                                                   

                                       </rich:fileUpload>   

           

                                          <h:panelGrid columns="1" border="0"    >

                          <h:panelGroup id="info">

                          <rich:panel bodyClass="info">

                              <f:facet name="header">

                                  <h:outputText value="Uploaded Files Info" />

                              </f:facet>

                              <h:outputText value="No files currently uploaded"

                                  rendered="#{uploadFileBean.size==0}" />

                              <rich:dataGrid columns="1" value="#{uploadFileBean.files}" var="file" rowKeyVar="row">

                                  <rich:panel bodyClass="rich-laguna-panel-no-header">

                                      <h:panelGrid columns="2">                              

                                          <h:panelGrid columns="2">

                                              <h:outputText value="File Name:" styleClass="celcomBlack01" />

                                              <h:outputText value="#{file.name}" styleClass="celcomBlack01" />

                                              <h:outputText value="File Length(bytes):" styleClass="celcomBlack01" />

                                              <h:outputText value="#{file.length}" styleClass="celcomBlack01" />

                                              <h:outputText value="File Type:" styleClass="celcomBlack01" />

                                              <h:outputText value="#{file.mime}" styleClass="celcomBlack01" />

                                          </h:panelGrid>

                                      </h:panelGrid>

                                  </rich:panel>

                              </rich:dataGrid>

                          </rich:panel>

                          <rich:spacer height="3"/>

                          <br />

                          <a4j:commandButton action="#{uploadFileBean.clearUploadData}"

                              reRender="info, upload" value="Clear Uploaded Data"

                              rendered="#{uploadFileBean.size>0}" />

                      </h:panelGroup>

                      </h:panelGrid>     

           

          <a4j:outputPanel ajaxRendered="true">

                          <h:panelGrid id="uploadinfoSuccess" columns="5" border="0"  rendered="#{uploadFileBean.forSuccess =='Success'}">

                                  <h:outputText id="fileupMessage" value="File Uploaded Successfully." styleClass="fieldError"/>

                                 

                          </h:panelGrid>

           

          Likewise manually u can add the output text for the displaying error in the screen.

           

          Thanks,

          Siva