0 Replies Latest reply on Sep 23, 2010 10:45 PM by gopi balagala

    rich:fileUpload

    gopi balagala Newbie
      I have done this rich:file upload its working fine but once file upload complete i have displayed alert message "successfully file upload", but its displayed every time, file can't upload that time also alert message displayed. how i will displayed error message in alert, please review this code, help me.


      Thanking you,



      <h:form id="uploadForm" style="width:450px;height:175px;">
              <rich:panel id="panelMenu" style=" width : 445px;">
                  <f:facet name="header">
                      <h:panelGroup>
                          <h:outputText value="Upload File"
                              style="font-size:14px;font-weight:bold;" />
                          <rich:spacer width="340" />
                          <h:graphicImage value="./img/closedpanel.png" styleClass="hidelink"
                              width="15px;" height="15px"
                              onclick="#{rich:component('ccModalPanelID')}.hide()" id="hidelink"
                              style="align:right;" />
                      </h:panelGroup>
                  </f:facet>
                  <h:panelGrid columns="1" columnClasses="top,top">
                      <h:message for="upload"
                          style="border: 1px solid #FFCC00;padding: 5px; margin-top: 5px; margin-bottom: 5px;
                      background-color: #F0F8FF; font-size: 12px;" />
                      <rich:messages id="errmessage" styleClass="error-panel" style=" width : 340px; height : 23px;"/>
                      <h:outputText
                          value="Click on the Add button to locate a file on your computer and upload it to this part." />
                      <rich:fileUpload fileUploadListener="#{fileUploadBean.listener}"
                          maxFilesQuantity="#{fileUploadBean.uploadsAvailable}" id="upload"
                          immediateUpload="true" ajaxSingle="true"
                          acceptedTypes="pdf, jpg, gif, png, bmp, pdf, doc, aac, aif, iff, mp3, ra, wav, wma, 3g2, 3gp, asf, asx, avi, flv, mov, mp4, mpg, rm, swf, vob, wmv, mkv"
                          listHeight="59px" noDuplicate="true" allowFlash="true">
                          <a4j:support event="onuploadcomplete" ajaxSingle="true" ignoreDupResponses="true" oncomplete="#{rich:component('ccModalPanelID')}.hide()" />
                          <a4j:support event="onfileuploadcomplete" oncomplete="alert('Successfully file uploaded!..');" id="sucesspopup">
                          <rich:componentControl for="uploadForm" attachTo="sucesspopup"
                          operation="#{rich:component('ccModalPanelID')}.hide()" event="onclick" />
                          <s:conversationPropagation type="join" />
                          </a4j:support>
                      </rich:fileUpload>
                  </h:panelGrid>
              </rich:panel>
          </h:form>