1
I have a table with a p:inputText
with a p:ajax
inside, the same holds the event change
, when I fill that inputText
with a value a query and some validations are performed. The problem is that when I glue a value within that inputText
(Ctrl+v) the method is called twice. If I type the value in inputText
rather than glue it the method works the right way, ie it is called only once.
xhtml:
<p:inputText id="codigoFunInput" label="Código"
mask="9?999999999" maxlength="7" slotChar=""
readonly="#{!item.novoFuncionario}"
style="width:100%;text-align:" value="#{item.codigo}">
<p:ajax event="change"
listener="#{mbean.carregaNomeFuncionario(item)}"
process="@this" partialSubmit="true"
update="dataTableResponsaveis, :formTopo:topoMessage" />
</p:inputText>
What could be "spoiling" this ajax request? I have other ajax events on the screen, but they serve other things.
Note: On the screen I also have some decorates on the screen too, I do not know this can influence.
Probably the event attribute Event="change" is being fired on the keyboard keyUp, as Ctrl + v are two keys, so there will be 2 events (I have no small project now to test). Have you tried using the delay attribute of p:ajax ? try something like delay="1000" and see if it works.
– wryel
I’ll try, I think I decided by changing to Blur and treating him, but if it works in the change is better
– DiegoAugusto
@wryel It worked, can answer the question :D
– DiegoAugusto