-
1. Re: <rich:fileupload> and oncomplete
sivaprasad9394 May 13, 2013 1:31 AM (in response to srikanthgoud)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