Cannot find component with identifier ":form:display" referenced from

I used DataTable - Row Selection from prime faces to display list of users and when I run the page I faced this error

Cannot find component with identifier ":form:display" referenced from "j_idt24:people:0:selectButton".

code of page

<!--    the part is very important 
if we did not put  <ui:composition> will will get a very ugly UI
-->
    <ui:composition>
    <h:head>
        <title>Contacts</title>
    </h:head>       
<!--    the part is very important --> 

    <body>
        <h:form>

          <p:growl id="msgs" showDetail="true" />  

          <p:dataTable id="people" var="person" value="#{personBean.users}">  

        <p:column headerText="ID" style="width:24%">  
            <h:outputText value="#{person.id}" />  
        </p:column>  

        <p:column headerText="Name" style="width:24%">  
            <h:outputText value="#{person.name}" />  
        </p:column>  

        <p:column headerText="Sex" style="width:24%">  
            <h:outputText value="#{person.sex}" />  
        </p:column>  

        <p:column headerText="Email" style="width:24%">  
            <h:outputText value="#{person.email}" />  
        </p:column>  

        <p:column style="width:4%">  
                <p:commandButton id="selectButton"  oncomplete="personDialog.show()" icon="ui-icon-search" title="View"  update=":form:display" >  
                    <f:setPropertyActionListener value="#{person}" target="#{personBean.selectedPerson}" />  
            </p:commandButton>  
        </p:column>  

    </p:dataTable>  

    <p:dialog header="Person Detail" widgetVar="personDialog" resizable="false" id="perDlg"  
                showEffect="fade" hideEffect="explode" modal="true">  

        <h:panelGrid id="display" columns="2" cellpadding="4" style="margin:0 auto;">  



            <h:outputText value="Name:" />  
            <h:outputText value="#{personBean.selectedPerson.name}" style="font-weight:bold"/>  

            <h:outputText value="Sex" />  
            <h:outputText value="#{personBean.selectedPerson.sex}" style="font-weight:bold"/>  


            <h:outputText value="Email" />  
            <h:outputText value="#{personBean.selectedPerson.email}" style="font-weight:bold"/>  



        </h:panelGrid>  

    </p:dialog>  

        </h:form>
    </body>
        </ui:composition>
</html>

what is the problem with my code ?

Upvotes: 1

Views: 16449

Answers (2)

zargarf
zargarf

Reputation: 643

You are using 'update=":form:display"' in your button, but your form does not have an id so ':form' is incorrect. If you give your form an id, e.g. myForm. Then you could use :myForm:display

Basically you need to take a look at Namingcontainers which you'll need to understand to reference elements(see for example: Naming Container in JSF2/PrimeFaces)

Upvotes: 4

user1983983
user1983983

Reputation: 4841

You have to set id="form" at the h:form. The randomly generated id in the error message which is prepended to the buttons id, is the generated id of the form. If you set it to form the id you used will work. An alternative would be to use a relative id in the update of the button.

Upvotes: 2

Related Questions