1 Reply Latest reply on Jan 23, 2012 10:17 AM by napartar

    Problem with onuploadcomplete event

    napartar

      Hi everybody,

       

      I have a problem with a fileUpload component, I want to display a form with this component, but once the file is uploaded and onuploadcomplete event fired, I don't want to render the component anymore and display a panelgrid in order of it. There is a listener method in my bean class which is firing when upload completes, I also have a variable there, which tell us if we have to display the fileupload component or the panel.

       

      I have tried two ways, setting the components into c:choose tags, which control what we're displaying depending on the variable value and in the other hand, setting the rendered attribute of the components depending on the variable. At the beginning fileupload component displays well, but when the file is uploaded and the event fired, the variable changes its value but the panel component doesn't display. This is my code:

       

      <h:panelGroup layout="block" id="uploadPanel">

                  <h:outputText value="#{msg.TITULO_ADD_APP}" styleClass="negrita" />

                  <br />

                  <br />

                  <c:choose>

                      <c:when test="#{manager._screenNumber == '1'}">

                          <a4j:form>

                              <rich:fileUpload fileUploadListener="#{manager.listener}"

                                  maxFilesQuantity="1" immediateUpload="true" acceptedTypes="jar"

                                  allowFlash="false" required="true" listHeight="60px">

                                  <a4j:support event="onuploadcomplete" reRender="uploadPanel" />

                              </rich:fileUpload>

                          </a4j:form>

                      </c:when>

                      <c:when test="#{manager._screenNumber == '2'}">

                          <h:panelGrid columns="2" cellspacing="8px" width="96%"

                              style="text-align:left">

       

                              <rich:column width="25%" style="border:none">

                                  <h:outputText value="#{msg.LBL_NOMBRE_APLICACION}"

                                      styleClass="negrita_2" />

                              </rich:column>

                              <rich:column width="30%" style="border:none">

                                  <h:outputText value="#{manager._appToInstall._Nombre}"

                                      styleClass="normal_2" />

                              </rich:column>

       

                              <rich:column width="25%" style="border:none">

                                  <h:outputText value="#{msg.LBL_DESCRIPCION}"

                                      styleClass="negrita_2" />

                              </rich:column>

                              <rich:column width="75%" style="border:none">

                                  <h:outputText value="#{manager._appToInstall._Descripcion}"

                                      styleClass="normal_2" />

                              </rich:column>

       

                              <rich:column width="25%" style="border:none">

                                  <h:outputText value="#{msg.LBL_VERSION} " styleClass="negrita_2" />

                              </rich:column>

                              <rich:column width="75%" style="border:none">

                                  <h:outputText value="#{manager._appToInstall._Version}"

                                      styleClass="normal_2" />

                              </rich:column>

       

                              <rich:column width="25%" style="border:none">

                                  <h:outputText value="#{msg.LBL_VERSIONES_COMP}"

                                      styleClass="negrita_2" />

                              </rich:column>

                              <rich:column width="75%" style="border:none">

                                  <rich:dataList var="version"

                                      value="#{manager._appToInstall._VersionesCompatibles}">

                                      <h:outputText value="#{version}" styleClass="normal_2" />

                                  </rich:dataList>

                              </rich:column>

                          </h:panelGrid>

                      </c:when>

                  </c:choose>

              </h:panelGroup>

       

      As you can see, component which has to be rerendered contains the component which fires the rendering event, I think this might be possible...

      onuploadcomplete method is only changing the value of the variable from "1" to "2".

       

      If you can help me I'll be very pleased, sorry because of my English...