12

I'm using PrimeFaces and a component within one layoutUnit must update another component which is within another layoutUnit:

<p:layout>
  <p:layoutUnit position="west" size="275" resizable="true" closable="true" collapsible="true">
    <h:form id="formWest">
      <div id="west">
        <ui:insert name="west"></ui:insert>
      </div>
    </h:form>
  </p:layoutUnit>
  <p:layoutUnit id="layout_center" position="center">
    <h:form id="formCenter">
      <div id="content">
        <ui:insert name="content"></ui:insert>
      </div>
    </h:form>
  </p:layoutUnit>
</p:layout>

The error message is: Caused by: javax.faces.FacesException: Cannot find component with expression "formWest:execucao" referenced from "formCenter:form:mapaGoogle".

The components that need to be updated are inside td so I did <td jsf:id="execucao">, for example.

Rasshu
  • 1,764
  • 6
  • 22
  • 53

1 Answers1

27

As you know when you refer components from another form you have to attach the form ID to the component Id.

You also need to know that you have to attach another : before the form ID, when refereing the compnent in different form.

Example:

<h:form id="form1">
    <p:inputText id="input1" />
</h:form>

Now if I want to update the input1 from another form I have to use:

:form1:input1

Example:

<h:form id="form2">
   <p:commandButton update=":form1:input1" />
</h:form>

In your case use:

:formWest:execucao
Kishor Prakash
  • 8,011
  • 12
  • 61
  • 92
  • Can you help me http://stackoverflow.com/questions/29018559/update-select-one-menu-from-another-page – csf Mar 12 '15 at 19:28
  • `p:page` adds another id to the final id you have to provide in `update` attribute. `p:page id="master"`, then `h:form id="form-list-financial-receipt"` and then `p:dataTable id="table-list-financial-receipt"` and the final component's id is: `:master:form-list-financial-receipt:table-list-financial-receipt`. Out of a real-life FLOSS project. – Roland Sep 28 '17 at 20:38