RichFaces的popupPanel:的commandButton需要两次点击 [英] richfaces popupPanel: commandButton requires two clicks

查看:286
本文介绍了RichFaces的popupPanel:的commandButton需要两次点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个弹出式窗口的一种形式,其上一个命令。当我点击命令按钮,我想提交表单并调用操作。

现在的问题是,如果我把命令按钮的形式,我必须点击它两次打电话的动作,如果我把它的形式外,它并没有提交表单。

下面是我的code:

 <丰富:popupPanel ID =弹出式模式=真了minWidth =600=了minHeight300
    调整大小=假>
    < F:面名=标头>
        < H:的outputText值=编辑/>
    < / F:面>
    < F:面名称=控制>
        < H:outputLink的价值=#ID =X
            的onclick =#{丰富:成分(弹出)}隐藏();返回false;&GT,X< / H:outputLink的>
    < / F:面>
    < H:格式ID =数据形>

        <表ID =表>
            &其中; TR>
                < TD>< H:的outputText值=细节:/>< / TD>
                < TD>< H:inputTextarea ID =细节
                        值=#{errorItemBean.workItem.details}/>< / TD>
            < / TR>
        < /表>

        < A4J:的commandButton ID =提交按钮值=确定
                行动=#{errorItemBean.create}重新呈现=errorForm
                的onComplete =#{丰富:成分(弹出)}隐藏()。>
            < / A4J:的commandButton>

        < H:的commandButton ID =cancelButton值=取消>
            <丰富:componentControl目标=弹出运行=隐藏/>
        < / H:的commandButton>
    < /小时:形式GT;
< /富:popupPanel>
 

解决方案

如果你已经使用重新呈现=可能发生:弹出打开弹出窗口前。你需要通过重新呈现=重新呈现弹出窗口的形式,而不是:数据形

参见:

  • <一个href="http://stackoverflow.com/questions/7807334/rendering-other-form-by-ajax-causes-its-view-state-to-be-lost-how-do-i-add-this">Rendering其他形式的阿贾克斯导致其视图状态就完了,我怎么添加这个回来?

I have a popup window with a form and a commandButton on it. When I click on the commandButton, I would like to submit the form and call an action.

The problem is that if I put the commandButton in the form, I have to click on it twice to call the action, and if I put it outside the form, it doesn't submit the form.

Here is my code:

<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>

解决方案

That can happen if you have used reRender=":popup" before opening the popup. You need to re-render the popup's form instead by reRender=":dataForm".

See also:

这篇关于RichFaces的popupPanel:的commandButton需要两次点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆