jsf - PrimeFaces ajax change of input and action on another field -


i have code, where, on change of value of input element, listen , update other fields.

the problem is, when change value of input field typing , hit commandbutton id: submit, triggers listener (probably because change of value checked during blur on field), not listener x, i.e actionlistener commandbutton. i've had click button again listener x invoked.

of course works expected if cause blur on input field clicking elsewhere , click on commandbutton. appears when blur of input field coincided click of commandbutton, blur happens - click of button ignored. ideas?

<p:inputtext ...>   <p:ajax event="change" update="..." listener="..." /> </p:inputtext>  ...  <p:commandbutton id="submit" ... actionlistener="x" /> 

edit: use primefaces v5.1 , jsf v2.1.19, fwiw.

i had similar issue (maybe same) using jsf , primefaces 6.1, , posted here:

primefaces inputtext ajax event=valuechange fires after commandbutton clicked

@jasper-de-vries replied valid, working solution :)

a quickie summary of post change ajax update seletor such:

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

which update specific elements (the form) not others (buttons) since valuechange or change event updates form including buttons disregards first click on button.


Comments