First faces pick chosen value in autocomplete

Asked

Viewed 453 times

1

I’m working with the AutoComplete of primefaces and I have a problem. For example, the user enters a word in the combo OSW and then the dropdown lists all contracts with the term as supplier OSW.

So far so good, but when the user selects the contract in the dropdown I can’t get the content selected by him, I can only get the word he typed to find the contract.

My code:

 <p:autoComplete id="inputTextFornecedorComplete" dropdown="true"forceSelection="true"
                                        minQueryLength="3" size="82" maxResults="15" 
                                        value="#{contratoNotaFiscalBean.sessionBean.itemPagina.contrato.chaveContrato}" class="autoCompletar"
                                        completeMethod="#{contratoNotaFiscalBean.completeText}" 
                                        rendered="#{contratoNotaFiscalBean.sessionBean.operacaoInclusao}">
      <f:ajax event="itemSelect" render="selectOneMenuChaveContrato" execute="@this"/>
  </p:autoComplete>     

Could someone give me an idea of how I can increment this code to get the chosen value on dropdown?

  • 1

    On the screen is filled the correct value?

  • Yes everything is correct, but in Bean when I access this variable {counterNotaFiscalBean.sessionBean.itemPagina.contrato.chaveContract} instead of seeing the value selected in the drop down comes only the value that the user entered :(

  • 1

    Have you debugged? If you don’t try this and see what’s coming.

  • Debugged, for example: If I type OSW in the drop down it lists all contracts from the OSW provider then the content that comes to me is OSW and not what is listed in the dropdown.

1 answer

1

Personal thanks to all for the help, I found the problem. I had to change this code:

 <f:ajax event="itemSelect" render="selectOneMenuChaveContrato" execute="@this"/>

For that:

 <p:ajax event="itemSelect" />

Thank you all!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.