在IE8上富文件:fileUpload extrenal清除按钮问题

时间:2014-10-08 11:15:04

标签: file-upload jsf-2 richfaces

我们正在从jsf 1.2升级到jsf 2.

我们正在使用apache myfaces 2.1和富面4.3.5

我们面临富裕的问题:fileUplaod。 以下是代码:

<h:form id="loadUsersForm">


 <h:panelGrid columns="1">

    <rich:fileUpload id="upload" 
                     acceptedTypes="csv"
                     immediateUpload="true" 
                     maxFilesQuantity="1" 
                     listHeight="0px" 
                     fileUploadListener="#{bean.uploadFile}"
                     addLabel="Ad File" 
                     uploadLabel="Upload">

            <a4j:ajax event="uploadcomplete" 
                      execute="@this" 
                      render="fText,clearButton" />
            <f:facet name="progress">
                <rich:progressBar style="display:none;"/>
            </f:facet>

    </rich:fileUpload>

    <h:commandButton id="clearButton" 
                     action="#{bean.clear}"  
                     onclick="#{rich:component('upload')}.clear();" 
                     value="Clear" />
 <h:panelGrid/>

</h:form>

如上面的代码所示,我们使用另一个按钮来清除上传的文件。 仅在IE8上观察到以下问题(其兼容性视图模式已打开):

1)单击清除按钮时,对于onlick脚本,#{rich:component('upload')}.clear(); IE控制台会出现错误:Object doesn't support this property or method并且未调用操作方法。当再次单击相同的按钮时,动作方法被称为sccessfully。

2)删除此脚本时,不会发现此错误。但是观察到动作方法的相同行为。仅当单击两次清除按钮时才调用动作方法。

有人遇到过这样的问题吗? 任何人都可以帮助解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

4.3.x中的fileUpload没有clear()方法,因为错误告诉您。请改用removeAllItems()