0

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?

Georgy Passos
  • 139
  • 1
  • 2
  • 9
  • possible duplicate of [How to reference components in JSF ajax? Cannot find component with identifier "foo" in view](http://stackoverflow.com/questions/8634156/how-to-reference-components-in-jsf-ajax-cannot-find-component-with-identifier) – perissf Jul 18 '14 at 06:48

1 Answers1

2

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"

Kishor Prakash
  • 8,011
  • 12
  • 61
  • 92