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

Using JSF and PrimeFaces 6.1 I have an inputText field as such:

<p:inputText value="#{backingBean.stringField}">
    <p:ajax event="valueChange" update="@form" />
</p:inputText>

and in the same form - commandButton:

<p:commandButton id="btnDoThatThing" 
                 ajax="true" 
                 immediate="true"
                 update="@form"
                 process="@this"
                 action="#{backingBean.doThatThing}"
</p:commandButton>

When I

  • make changes to the inputText field,
  • then click somewhere OTHER THAN the command button
  • click on the button

everything works exactly as expected. BUT if I:

  • make changes to the inputText field,
  • press the button

the button does NOT fire because the first click of the Command command fires the valueChange event in the inputText field.

if I click on it a second time, the action of the button will finally happen.

, p:ajax event="valueChange" p:ajax event="keyup", commandButton , , , , keyup inputField , (/ , , "" ..)

, inputText, commandButton, Text?

!

+3
1

valueChange. , . 100%, , Chromium (Linux) ( ) .

, update selector. , (). :

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

, change , event="valueChange".

, . (, ), :

<p:ajax update="yourPanel" />

, ajax="true" p:commandButton, .

+4

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