Reputation: 159
My main form is the following:
<h:form id="frmSearch" styleClass="m-bottom">
<div class="form-group">
<label>Funcionário</label>
<h:inputText id="funcionario" value="#{escalaTrabalhoBean.entityToSearch.funcionario.pessoa.nome}" readonly="true" styleClass="form-control" />
<h:commandButton id="btnFuncionario" styleClass="btn btn-default" value="Buscar funcionário" onclick="$('#modBuscaFuncionario').modal('show')" type="button" />
</div>
</h:form>
And I want to update the value of field "funcionario" after I call a function with ajax, which is inside a modal window:
<h:form id="frmSearchBuscaFuncionario">
<h:commandLink id="btnSelecionar" title="Selecionar" actionListener="#{escalaTrabalhoBean.selectFuncionario(obj)}">
<i class="fa fa-pencil-square-o"></i>
<p:ajax oncomplete="$('#modBuscaFuncionario').modal('hide');" update="frmSearch:funcionario" />
</h:commandLink>
</h:form>
This code: update="frmSearch:funcionario" is not working, and I got this error: javax.faces.FacesException: Cannot find component with identifier "frmSearch:funcionario".
Any suggestions?
Upvotes: 0
Views: 1245
Reputation: 8151
When you access the components outside of your current h:form
use :
at the beginning of the Id of the component.
In your example:
update=":frmSearch:funcionario"
Upvotes: 2