3 Replies Latest reply on Feb 12, 2009 7:25 AM by Nick Belaevski

    problems with dynamically created, flash-enabled rich:fileUp

    Zack Marrapese Newbie

      I am working on an application which dynamically adds tabs to a rich:tabPanel:

      
      public void addTab(ActionEvent event)
      {
       HtmlTab tab = (HtmlTab)getFacesContext().getApplication().createComponent(HtmlTab.COMPONENT_TYPE);
       tab.setId("tab" + getSelectedSda());
       tab.setLabel("SDA " + getSelectedSda());
       tab.getChildren().add(createUploader(getSelectedSda()));
       getTabPanel().getChildren().add(tab);
      
       updateSdaList();
      
      }
      


      Within this tab I am creating a rich:fileUpload object:

      private HtmlFileUpload createUploader(String selectedSda)
      {
       HtmlFileUpload fileUpload = (HtmlFileUpload)getFacesContext().getApplication().createComponent(HtmlFileUpload.COMPONENT_TYPE);
       fileUpload.setId("Upload"+selectedSda);
       fileUpload.setAcceptedTypes("jpg, gif, png, bmp");
       fileUpload.setAjaxSingle(true);
       fileUpload.setAllowFlash("true");
       fileUpload.setMaxFilesQuantity(MAX_FILES_ALLOWED_PER_SDA);
      
       //must use deprecated class in order to use setFileUploadListener.
       Class[] param = {UploadEvent.class};
       MethodBinding fileUploadListener = getFacesContext().getApplication().createMethodBinding("#{fileUploadManager.uploadFile}", param);
      
       fileUpload.setFileUploadListener(fileUploadListener);
       fileUpload.getChildren().add(createSdaParam());
       fileUpload.getFacets().put("label", createProgressBarFacet());
      
       return fileUpload;
      }
      


      This works just fine in google chrome. It allows me to upload and do everything.

      However, in FF and IE7, when I create the tab with the fileUpload object in it, the add button is disabled. Everything works if allowFlash="false". However, if flash is enabled, it doesn't even seem to load the flash portion of it (ie. the add button.) and the add button doesn't do anything when clicked.

      Anyone have any suggestions? Thanks in advance
      ~Zack