【问题标题】:rich:fileUpload extrenal Clear button issue on IE8丰富:文件上传外部清除 IE8 上的按钮问题
【发布时间】:2014-12-03 00:48:28
【问题描述】:

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

我们使用的是 apache myfaces 2.1 和 rich faces 4.3.5

对于rich: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 并且未调用操作方法。当再次点击同一个按钮时,动作方法被成功调用。

2)当这个脚本被删除时,这个错误不会被观察到。但是观察到 action 方法的行为相同。只有单击两次清除按钮时才会调用 action 方法。

有人遇到过这样的问题吗? 谁能帮忙解决这个问题?

【问题讨论】:

    标签: file-upload jsf-2 richfaces


    【解决方案1】:

    4.3.x 中的 fileUpload 没有 clear() 方法,正如错误告诉你的那样。请改用removeAllItems()

    【讨论】:

    • 感谢您的回答。我将尝试上述修复并更新帖子。同时,是否有解释 Rich Faces 4.3 更改的 java 脚本方法的文档链接?
    • 我们有一个migration guide,但我不能保证一切都包括在内。
    猜你喜欢
    • 2011-05-31
    • 2012-09-12
    • 2011-11-29
    • 1970-01-01
    • 1970-01-01
    • 2011-09-01
    • 2012-04-13
    • 2015-03-12
    • 1970-01-01
    相关资源
    最近更新 更多