8 Replies Latest reply on Dec 1, 2008 9:36 AM by ilya_shaikovsky

    How to reRender + execute an action after onuploadcomplete()

    jobb

      What I need is to perform after completed fileUpload is :
      1. run an action
      2. reRender inputText om the page

      <script type="text/javascript">
       function testUploadEnd(){
       js_PDUploadEnd();
       }
      </script>
      
      <a4j:jsFunction name="js_PDUploadEnd" action="#{fileUploadMBean.getUploadEnd}" reRender="urlExampleFilInputText" oncomplete="alert('js_PDUploadEnd completed')">
      </a4j:jsFunction>
      
      <h:panelGrid >
       <h:inputText id="urlExampleFilInputText" value="#{productRestMBean.urlExampleFil}">
      </h:panelGrid>
      
      <h:panelGrid id="fileUploadGrid" >
       <rich:fileUpload id="fileUpload" fileUploadListener="#{fileUploadMBean.fileUploaded}"
       onuploadcomplete="testUploadEnd();">
       </rich:fileUpload>
      </h:panelGrid>
      
      


      The code here is simple, showing that testUploadEnd() is triggered onuploadcomplete().

      This function call javascript function js_PDUploadEnd()
      which perform action="#{fileUploadMBean.getUploadEnd}" and after that, componend with id="urlExampleFilInputText" should be reRendered.

      Function js_PDUploadEnd() is executed, but action="#{fileUploadMBean.getUploadEnd}" is NOT executed and there is NO reRendering of id="urlExampleFilInputText" ???
      oncomplete() for js_PDUploadEnd() shows alert.

      Can someone explain me why action and reRendering does'nt execute and how to get this to work?