【问题标题】:richfaces popupPanel: commandButton requires two clicksrichfaces popupPanel:commandButton 需要点击两次
【发布时间】:2012-02-25 23:43:03
【问题描述】:

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

问题是,如果我把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>

【问题讨论】:

    标签: ajax jsf-2 popup richfaces


    【解决方案1】:

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

    另见:

    【讨论】:

    • 如果我还想重新渲染弹出窗口的标题方面怎么办?
    猜你喜欢
    • 1970-01-01
    • 2015-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-09
    相关资源
    最近更新 更多