<电话号码:的commandButton>不会在第一次点击提交表单,如果<电话号码:inputText的>字段使用<电话号码:AJAX> [英] <p:commandButton> won't submit form on first click if <p:inputText> field uses <p:ajax>

查看:180
本文介绍了<电话号码:的commandButton>不会在第一次点击提交表单,如果<电话号码:inputText的>字段使用<电话号码:AJAX>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在遇到以下形式的问题:

I'm having an issue with the following form:

<h:form>
    <p:outputPanel autoUpdate="true">
        <p:panelGrid columns="2">
            <f:facet name="header">
                <h:outputText value="Edit a Recycler"/>
            </f:facet>

            <p:outputLabel value="Recycler Name" for="recyclerName"/>
            <p:inputText id="recyclerName" value="#{RecyclerAdmin.editItem.company.companyName}" required="true" requiredMessage="You must name the recycler.">
                <p:ajax async="true" />
            </p:inputText>

            <p:outputLabel value="Zip Code" for="zipCode"/>
            <p:inputText id="zipCode" value="#{RecyclerAdmin.editItem.company.primaryAddressId.zip}" required="false">
                <p:ajax event="blur" async="true" update="citystate" listener="#{RecyclerAdmin.zipCodeChanged}"/>
            </p:inputText>

            <p:outputLabel value="City/State"/>
            <c:choose>
                <c:when test="${RecyclerAdmin.editItem.company.primaryAddressId.city != null and RecyclerAdmin.editItem.company.primaryAddressId.city.length() > 0}">
                <h:outputText id="citystate" value="#{RecyclerAdmin.editItem.company.primaryAddressId.city}, #{RecyclerAdmin.editItem.company.primaryAddressId.state}"/>
                </c:when>
                <c:otherwise>
                    <p:spacer id="citystate"/>
                </c:otherwise>
            </c:choose>

            <f:facet name="footer">
                <p:commandButton id="updatebutton" action="#{RecyclerAdmin.update()}" value="Save" ajax="false"/>
                <p:commandButton id="cancelbutton" action="#{RecyclerAdmin.cancel}" value="Cancel" ajax="false" immediate="true"/>
            </f:facet>

        </p:panelGrid>
    </p:outputPanel>
</h:form>

如果我做出改变的回收站名称文本字段,然后立即点击保存按钮,点击按钮突出激活,并且一直保持有效,但形式不提交,直到按钮被点击第二次。如果我点击别的地方点击保存按钮之前,一切正常,如果我删除Ajax的异步=真,从recyclerName领域,形式也将提交正常,但我需要的Ajax参考的,否则任何更改的值当拉链code场被操纵场被删除。

If I make a change to the "Recycler Name" text field, and then immediately click on the save button, the button click highlighting activates, and remains active, but the form does not submit until the button is clicked a second time. If I click somewhere else before clicking on the save button, everything works, and if I remove the ajax async="true" from the recyclerName field, the form also will submit normally, but I need the ajax reference otherwise any changed values in the field are erased when the zipCode field is manipulated.

任何想法?

推荐答案

这个问题是由outputPanel自动更新=真的标签造成的。我已经添加了特定的更新字段引用个别AJAX标签和问题,现在已经没有了。

The problem was caused by the outputPanel autoUpdate="true" tag. i have added specific update field references to the individual ajax tags and the problem is now gone.

这篇关于&LT;电话号码:的commandButton&GT;不会在第一次点击提交表单,如果&LT;电话号码:inputText的&GT;字段使用&LT;电话号码:AJAX&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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