webtier@glassfish.java.net

f:ajax render wrong

From: <webtier_at_javadesktop.org>
Date: Fri, 11 Jun 2010 09:50:53 PDT

Hello,

I would like to ask you for help :).

I have a little ajax call wich just should make a new object in a list of elements and after render again the form.

When I call to the method I can make the process without problems and I see in the variables that I create the new object. But when everything it is done and the application paint the results, the results are not updated. It paints the data from the before call.

For example, if I pushed the button two times, the first time don't paint anything new and the second time paint the first object created.

This is my code:

--XHTML--
                <h:form id="phoneEditForm">
                    <h:panelGrid columns="4" styleClass="reg_table" columnClasses="reg_col_label,reg_col,reg_col,reg_col_small_wide">
                        <c:forEach var="item" items="${sessionBean.profile.contactInformationsPhone}">
                            <h:selectOneMenu value="#{item.kind}">
                                <f:selectItem itemLabel="Telefon" itemValue="PHONE" />
                                <f:selectItem itemLabel="Mobil" itemValue="MOBILEPHONE" />
                            </h:selectOneMenu>
                            <h:inputText value="#{item.content}"/>
                            <h:selectOneMenu value="#{item.visibility}">
                                <f:selectItem itemLabel="Versteckt" itemValue="PRIVAT" />
                                <f:selectItem itemLabel="Öffentlich" itemValue="PUBLIC" />
                            </h:selectOneMenu>
                        </c:forEach>
                        <h:panelGroup/><h:panelGroup/><h:panelGroup/>

                        <h:commandButton image="/p/images/add_button_original.png" actionListener="#{profileEditBean.newContactInformationPhone}">
                            <f:ajax event="action" execute="phoneEditForm" render="phoneEditForm :phoneOutputForm"/>
                        </h:commandButton>

                        <input type="button" value="Abbrechen" onclick="javascript:slide('#phoneOutput');slide('#phoneEdit');"/>
                        <h:panelGroup/>
                        <h:commandButton value="Speichern" actionListener="#{profileEditBean.save}"/>
                        <h:panelGroup/>
                    </h:panelGrid>
                </h:form>

--XHTML--

--BEAN--
    public void newContactInformationPhone() {
            profile.addContactInformation(new ContactInformation(ContactInformationVisibility.PRIVAT, ContactInformationKind.PHONE, ContactInformationType.WORK, null));
    }
--BEAN--


Thank you very much in advance :)

Alex
[Message sent by forum member 'alex1712']

http://forums.java.net/jive/thread.jspa?messageID=473925