我在modalPanel中有这个inputTextarea,而我在后备bean中更新各自值(motivePopupMotive)的唯一方法是在inputTextarea中添加a4j:support,以设置ajaxSingle = true,如下所示:

<a4j:support event="onchange" ajaxSingle="true"></a4j:support>


在通过单击“ btnSavePopupMotive”按钮调用保存方法之前。如果我不这样做,那么当我单击“ btnSavePopupMotive”按钮时,备用Bean中的值始终为空字符串。

但是我不想要这种解决方案,因为当我调用ajax函数时,我会显示一个“正在加载”图像,并且我不希望仅由于用户在此输入中输入一些文本而显示该图像。我该如何解决?这是代码:

<div style="position: absolute;">
    <a4j:form id="form2">
        <r:modalPanel id="panelPopupMotive" resizeable="false" autosized="true" minWidth="300" minHeight="20" >

            <table width="99%" bgcolor="#FFFFFF" style="border-collapse: collapse; border: 0px solid #000000;">
                <tr><td>
                        <fieldset>
                            <legend class="fmeSmallLegend"><h:outputText value="Motive" /> </legend>
                            <table><tr><td>
                                <h:inputTextarea id="motivePopupMotive"
                                    onkeydown="verifySize(this, 200);"
                                    onkeyup="verifySize(this, 200);"
                                    onchange="verifySize(this, 200);"
                                    value="#{ParameterFaces.motivePopupMotive}"
                                    rows="4" style="width: 380px;" onfocus="this.style.background='#FFFED2';" onblur="this.style.background='#F5F5F5';">
                                </h:inputTextarea>
                            </td></tr></table>
                        </fieldset>
                </td></tr>
                <tr>
                    <td align="center">
                        <a4j:commandButton id="btnSavePopupMotive"
                            value="Save" onclick="saveMotive();"
                            style="width:80px" type="submit"
                            oncomplete="closePopupMotive();"
                            title="Save" reRender="motivePopupMotive,existsErrorMotive">
                        </a4j:commandButton>
                        <r:spacer width="5px" />
                        <a4j:commandButton id="btnCancel"
                            value="Cancel" style="width:80px"
                            oncomplete="Richfaces.hideModalPanel('panelPopupMotive');"
                            title="Cancel">
                        </a4j:commandButton>
                    </td>
                </tr>
            </table>
            <script type="text/javascript">
                function closePopupMotive(){
                    if (document.getElementById('form2:motivePopupMotive').value == 'false'){
                        Richfaces.hideModalPanel('panelPopupMotive');
                    }
                }
            </script>

            <a4j:jsFunction name="saveMotive" reRender="motivePopupMotive" oncomplete="saveValidatedMotive();"/>

            <a4j:jsFunction name="saveValidatedMotive" actionListener="#{ParameterFaces.save}" reRender=""/>
        </r:modalPanel>
    </a4j:form>
</div>


谢谢!!

最佳答案

原来是因为我在窗体内使用了modalPanel ...我将窗体放在modalPanel之外,并且一切正常。

08-06 21:45