简体   繁体   中英

Fail to update h:outputText tag with (Primefaces) p:ajax call

I want for user while typing name, update name field in tab id="tab4" of accordionPanel. Gives me an error with java.lang.IllegalArgumentException: out - the id of the tab

    <ui:define name="contentBody">
        <h:form id="form2">

        <p:accordionPanel id="maintab" multiple="true">
        <p:tab title="New Order">
            <h:panelGrid columns="1" cellpadding="5"> 

            <p:tabView id="tabView">
                <p:tab title="Client" id="tab1">
                    <h:panelGrid columns="6" cellpadding="5">

                        <h:outputText value="Name " />
                        <p:inputText id="name" value="#{newOrderBean.name}">
                            <p:ajax update=":form2:maintab:out:name_id" />
                        </p:inputText>

                    </h:panelGrid>
                </p:tab>
            </p:tabView>

            </h:panelGrid>
        </p:tab>

        <p:tab id="out" title="View Deatails">
            <h:panelGrid id="panelgrid" columns="3" cellpadding="5">
                <p:panel id="panel1" header="Client" style="width:200px;height:200px" >
                    <h:panelGrid id="grid1" columns="1">  
                        <h:outputText id="name_id" value="#{newOrderBean.name}" />
                    </h:panelGrid>
                </p:panel>

            </h:panelGrid>
        </p:tab>
        </p:accordionPanel>

        </h:form>
    </ui:define>

could you please also clarify about the cases where i need to put my components into separate forms cause just for now i put the whole page into a single form tag. Thank you

Solved it! With this code:

<h:outputText value="Name " />
<p:inputText id="name" value="#{newOrderBean.name}">
    <f:ajax event="keyup" render=":form2:maintab:name_id" />
</p:inputText>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM