1 Reply Latest reply on Oct 16, 2010 10:21 AM by jsoye

    Faces Messages and a4j:support

    qbit42

      Hello,


      I have a problem to display faces messages on a ajax event. I try to accomplish a better error feedback with the rich:fileUpload, because there is a lot of file validation in the backend.


      My uploader looks like this:


      <a4j:region>
           <h:form id="uploadForm">
                <rich:fileUpload id="fileUpload" listWidth="922px" listHeight="290px" locale="de_DE" noDuplicate="true" allowFlash="false"
                     fileUploadListener="#{PaddialogUploadService.uploadFile}" maxFilesQuantity="#{PaddialogUploadService.maxUploads}"
                     lots of labels here... >
                     <f:facet name="progress">
                          <rich:progressBar style="width: 100%;"/>
                     </f:facet>
                     <a4j:support event="onuploadcomplete" action="#{PaddialogUploadService.clearUploads}" reRender="fileUpload" />
                     <a4j:support event="onfileuploadcomplete" oncomplete="alert('file complete!');" reRender="facesMessage" />
                </rich:fileUpload>
           </h:form>
      </a4j:region>



      While handling the files in the background, faces messages will be thrown/added if an error occurs.


      The first a4j:support clears the upload list and works fine. The second one (called after every file) should reRender the global messages component:


      <h:form id="facesMessage">
           <h:messages id="messages" layout="list"
                styleClass="Messages"
                infoClass="Info"
                warnClass="Warning"
                errorClass="Error"
                fatalClass="Fatal" />
      </h:form>



      The a4j event realy gets called, but the message form never gets rerendered and I get the warning in the log that messages had been enqueued, but never had been displayed.


      What am I making wrong? Shouldn't reRender be enough to get the actual messages?