Hi all,
I am using the rich:fileupload component in my project. It's really great. However I got some troubles when I tried to get the entry.state.
I have read http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/html/fileUpload.html
And this is an example in the page
...
<rich:fileUpload fileUploadListener="#{fileUploadBean.listener}"
maxFilesQuantity="#{fileUploadBean.uploadsAvailable}"
reRender="table" id="upload"
immediateUpload="#{fileUploadBean.autoUpload}"
acceptedTypes="jpg, gif, png, bmp">
<a4j:support event="onuploadcomplete" reRender="info" />
</rich:fileUpload>
<h:commandButton onclick="if($('j_id232:upload').component.entries[0].state == FileUploadEntry.UPLOAD_SUCCESS) alert ('DONE');" value="Check file state"/>
...
It seems that "$('j_id232:upload').component" should be different for different pages. So how can i get my value?
Any help will be appreciated.
Sam
Sam,
Try to use rich:component function:
if(#{rich:component('upload')}.entries[0].state == FileUploadEntry.UPLOAD_SUCCESS) alert ('DONE');