PrimeFaces ajax change input and actions in another field

I have this code where, when changing the value of an input element, I listen and update some other fields.

The problem is that when I change the value of this input field, typing something and click commandButtonwith the identifier: submitit calls the listener (perhaps because the value change is checked during the time blurin the field), but not the listener X, i.e. actionListenerfor commandButton. So I had to press the button again for the listener Xto call.

Of course, it works as expected if I call the blur in the input field by clicking elsewhere, and then click commandButton. It seems that when the blur of the input field coincides with the click commandButton, only the blur occurs - the click of the button is simply ignored. Any ideas?

<p:inputText ...>
  <p:ajax event="change" update="..." listener="..." />
</p:inputText>

...

<p:commandButton id="submit" ... actionListener="X" />

EDIT: I am using PrimeFaces v5.1 and JSF v2.1.19, FWIW.

+4
source share
1 answer

I had a similar problem (maybe the exact same one) using JSF and PrimeFaces 6.1, and posted it here:

PrimeFaces inputText ajax event = valueChange fires AFTER the Button command is activated

@ jasper-de-vries answered with a valid working solution :)

a brief summary of his post is to change the ajax update to seletor as such:

<p:ajax update="@(form :input:not(button))" />

(), (), Change , , .

0

Source: https://habr.com/ru/post/1598278/