ajax - richfaces popupPanel : commandButton requires two clicks

标签 ajax jsf-2 popup richfaces

我有一个弹出窗口,上面有一个表单和一个命令按钮。当我单击命令按钮时,我想提交表单并调用操作。

问题是,如果我将commandButton放在表单中,我必须单击它两次才能调用操作,如果我将它放在表单之外,它不会提交表单。

这是我的代码:

<rich:popupPanel id="popup" modal="true" minWidth="600" minHeight="300"
    resizeable="false">
    <f:facet name="header">
        <h:outputText value="Edit" />
    </f:facet>
    <f:facet name="controls">
        <h:outputLink value="#" id="x"
            onclick="#{rich:component('popup')}.hide(); return false;">X</h:outputLink>
    </f:facet>
    <h:form id="dataForm">

        <table id="table">
            <tr>
                <td><h:outputText value="Details:" /></td>
                <td><h:inputTextarea id="details"
                        value="#{errorItemBean.workItem.details}" /></td>
            </tr>               
        </table>

        <a4j:commandButton id="submitButton" value="Ok"
                action="#{errorItemBean.create}" reRender="errorForm"
                oncomplete="#{rich:component('popup')}.hide()">
            </a4j:commandButton>

        <h:commandButton id="cancelButton" value="Cancel">
            <rich:componentControl target="popup" operation="hide" />
        </h:commandButton>
    </h:form>
</rich:popupPanel>

最佳答案

如果您在打开弹出窗口之前使用了 reRender=":popup",则可能会发生这种情况。您需要通过 reRender=":dataForm" 重新渲染弹出窗口的表单。

另请参阅:

关于ajax - richfaces popupPanel : commandButton requires two clicks,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9127250/

相关文章:

javascript - 在 AJAX 中发送帖子

php - 使用 XMLHttpRequest 上传文件

java - 更改为 java.sql.Date 时未调用 Bean 方法

javascript - 10秒后关闭弹出窗口

javascript - 一键登录

javascript - jQuery ajax 从另一台服务器加载 html

ajax - Ajax和Java中的Web Worker有什么区别?

java - 从 JSF 1.2 迁移到 2.0 的问题

java - 如何聚焦 p :selectBooleanButton component using tab key?

ios - 以编程方式创建一个在设备旋转时保持其大小的 UIView