0
votes

I have a primefaces autocomplete input which displays cities. I want to fill zip code when autocomplete input lose focus. when I select the city whith the enter key the autocomplete input doesn't lose focus and the when i press tab key zipcode is filled and get focus, that is ok for me, but when I select city whith mouse listner method which fill zipcode is called with typed chars istead of a selected value and the autocomplete input lose focus.

is there any idea to get select with mouse working.

Thank you for your help.

My code is like that:

<p:autoComplete
  value="#{myBean.city}"
    completeMethod="#{autoComplete.completeCity}"
    var="v"
    itemLabel="#{v.city}"
    itemValue="#{v.city}">
    <f:ajax event="blur" render="zipcode" listener="#{myBean.fillZipCode}" />   
</p:autoComplete>

my config : jsf 2 PrimeFaces 3.0.RC1

2

2 Answers

1
votes

I think this is happening because the inputText loses it's focus before the old value being changed with the one from DB. Try something else beside blur. I must say I've never encountered this problem.

Also it would be for the best for you to learn some English...

1
votes

There are other events available like blur, keyup, keydown, keypress, mouseup, mousedown, mousemove, mouseout, mouseover, select, focus, change, click, dblclick. If available even action, valueChange