0
votes

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>

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.

Any ideas?

2
lets wait for BalusC :)Kalpesh Soni
Ha, I wish; he just edited the question though as the problem is not related to Java SE...Rosswerks

2 Answers

2
votes

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.

2
votes

try different event

try removing async=true

p:ajax event="keyup"

http://www.primefaces.org/showcase/ui/ajax/event.xhtml