6 Replies Latest reply on Sep 16, 2009 6:32 AM by Matt Davies

    FileUpload in IE - Javascript error

    Matt Davies Newbie

      Hey all,

      I have a problem that only occurs in IE 7. Could be other IE, but I only have access to IE7. FF is OK. This only occurs when I use allowFlash="true"


      When I try to use the fileUpload widget I get an error in IE. Javascript -
      Line: 3
      Char: 6660
      Error: Unexpected call to method or property access
      Code: 0

      I can use the demo site just fine, but when I paste the code from the demo site into my site I get the error.

      My code:

      <h:form>
       <rich:fileUpload
       fileUploadListener="#{workOrderAction.listenerSamplePictures}"
       maxFilesQuantity="100"
       acceptedTypes="jpg, gif, png, bmp"
       listHeight="50"
       id="upload"
       autoclear="true"
       allowFlash="true"
       rendered="true"
       immediateUpload="#{workOrderAction.autoUpload}" >
      
       <f:facet name="label">
       <h:outputText value="{_KB}KB from {KB}KB uploaded --- {mm}:{ss}"></h:outputText>
       </f:facet>
      
       <a4j:support event="onuploadcomplete" reRender="samplePictureRegion" />
       </rich:fileUpload>
       </h:form>


      I searched some on the net and it appears that it could be a css styling issue that isn't correctly applied.

      Ideas? Why does the demo site work with the allowFlash, but I cannot get my site to do the same?


        • 1. Re: FileUpload in IE - Javascript error
          Andrei Markavtsov Apprentice

          Hi,

          Can you please post more info (RF version, full page, RF context params in your web.xml).

          I cannot see the problem on my environment

          Thanks.

          • 2. Re: FileUpload in IE - Javascript error
            Matt Davies Newbie

            Thanks!

            RF 3.2.2 GA
            Seam 2.0.3.CR1

            Page code:

            <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
             xmlns:s="http://jboss.com/products/seam/taglib"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:c="http://java.sun.com/jstl/core"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:rich="http://richfaces.org/rich"
             template="/layout/template.xhtml"
             xmlns:a4j="http://richfaces.org/a4j">
            
            <ui:define name="body">
            <ui:include src="workOrderActions.xhtml" />
            <rich:spacer height="10px" />
            
            
            
            <h:form>
             <rich:fileUpload
             fileUploadListener="#{workOrderAction.listenerSamplePictures}"
             maxFilesQuantity="100"
             acceptedTypes="jpg, gif, png, bmp"
             listHeight="50"
             id="upload"
             autoclear="true"
             allowFlash="true"
             rendered="true"
             immediateUpload="#{workOrderAction.autoUpload}" >
            
             <f:facet name="label">
             <h:outputText value="{_KB}KB from {KB}KB uploaded --- {mm}:{ss}"></h:outputText>
             </f:facet>
            
             <a4j:support event="onuploadcomplete" reRender="samplePictureRegion" />
             </rich:fileUpload>
             </h:form>
            
            
            
             <a4j:outputPanel id="samplePictureRegion" rendered="#{s:hasRole('Admin')}" >
             <fieldset class="workOrderFieldset " id="samplePictures">
             <legend>Sample Pictures</legend>
            
            
             <rich:dataGrid columns="3" value="#{workOrderAction.samplePictures}" rendered="#{workOrderAction.samplePictures.size() > 0}" var="entry" id="samplePictureTable">
             <rich:column >
             <f:facet name="header">Picture</f:facet>
             <h:form>
             <h:panelGrid columns="3" rendered="#{!empty entry.fileName}">
             <h:column>
             <a4j:mediaOutput element="img" mimeType="image/png"
             createContent="#{workOrderAction.paint}" value="#{entry.id}"
             style="width:100px; height:100px;" />
             </h:column>
             <h:column>
             <rich:spacer width="10px;" />
             </h:column>
             <h:column>
             <rich:spacer width="10px;" />
             </h:column>
             <h:column>
             <h:commandButton action="#{workOrderAction.downloadSamplePicture( entry )}"
             value="Download" />
             </h:column>
             <h:column>
             <rich:spacer width="10px;" />
             </h:column>
             <h:column>
             <a4j:commandButton action="#{workOrderAction.clearUploadedSamplePicture( entry )}"
             reRender="samplePictureRegion" value="Remove" immediate="false"
             onclick="if (!confirm('Are you sure you wish to continue?'))return false;"/>
             </h:column>
            
             </h:panelGrid>
             </h:form>
             </rich:column>
            
             </rich:dataGrid>
            
             </fieldset>
            
             </a4j:outputPanel>
            
            
            
            </ui:define>
            </ui:composition>



            web.xml

            <?xml version="1.0" encoding="UTF-8"?>
            <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
             <context-param>
             <param-name>org.richfaces.SKIN</param-name>
             <param-value>blueSky</param-value>
             </context-param>
            
            
             <context-param>
             <param-name>facelets.DEVELOPMENT</param-name>
             <param-value>false</param-value>
             </context-param>
             <context-param>
             <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
             <param-value>.xhtml</param-value>
             </context-param>
            
            
             <listener>
             <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
             </listener>
            
             <filter>
             <filter-name>Seam Filter</filter-name>
             <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
             <init-param>
             <param-name>createTempFiles</param-name>
             <param-value>true</param-value>
             </init-param>
             <init-param>
             <param-name>maxRequestSize</param-name>
             <param-value>1000000000</param-value>
             </init-param>
             </filter>
             <filter-mapping>
             <filter-name>Seam Filter</filter-name>
             <url-pattern>/*</url-pattern>
             </filter-mapping>
            
            
            
            
            
            
             <servlet>
             <servlet-name>Seam Resource Servlet</servlet-name>
             <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
             </servlet>
            
             <servlet-mapping>
             <servlet-name>Seam Resource Servlet</servlet-name>
             <url-pattern>/seam/resource/*</url-pattern>
             </servlet-mapping>
            
             <servlet>
             <servlet-name>Faces Servlet</servlet-name>
             <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
             <load-on-startup>1</load-on-startup>
             </servlet>
            
             <servlet-mapping>
             <servlet-name>Faces Servlet</servlet-name>
             <url-pattern>*.html</url-pattern>
             </servlet-mapping>
             <session-config>
             <session-timeout>30</session-timeout>
             </session-config>
             <!-- The Usual Welcome File List -->
             <welcome-file-list>
             <welcome-file>index.html</welcome-file>
             </welcome-file-list>
             <security-constraint>
             <display-name>Restrict raw XHTML Documents</display-name>
             <web-resource-collection>
             <web-resource-name>XHTML</web-resource-name>
             <url-pattern>*.xhtml</url-pattern>
             </web-resource-collection>
             <auth-constraint/>
             </security-constraint>
             <login-config>
             <auth-method>BASIC</auth-method>
             </login-config>
            </web-app>
            




            • 4. Re: FileUpload in IE - Javascript error
              Matt Davies Newbie

              Thanks,

              I updated my web.xml to the following

              <context-param>
               <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
               <param-value>false</param-value>
               </context-param>
               <context-param>
               <param-name>org.ajax4jsf.COMPRESS_STYLE</param-name>
               <param-value>true</param-value>
               </context-param>


              I now get the ADD button, but when I click on it nothing happens. I have tried changing the COMPRESS_STYPE to false and true with the same effect.

              Thanks again.

              • 5. Re: FileUpload in IE - Javascript error
                Andrei Markavtsov Apprentice

                This problem was resolved recently. It is the same as https://jira.jboss.org/jira/browse/RF-4480.

                You can try the latest RF snapshot with fix.

                Thanks.

                • 6. Re: FileUpload in IE - Javascript error
                  Matt Davies Newbie

                  A little late in posting... Thanks for the help. All is great