Not from Submit with only 1 click in form if the focus is on a p:ajax field

Asked

Viewed 69 times

0

I’m not getting the Submit in the form with just one click. When I click "Ok" the field loses the Focus and processes the ajax. Then I have to click again to send.

...

<p:outputLabel value="Teste:" />                        
<p:inputText value="#{testeController.campoTeste}" id="campoTeste">
    <p:ajax listener="#{testePontoController.testeAjax}" event="blur" update="@this"/>
</p:inputText>

...

<p:commandButton value="Ok" action="#{testeController.cadastrarTest()}"/>

....

Does anyone know how to fix this?

Thank you

  • 2

    My dear, try using the 'process' parameter on your button (example: process="@this", or put the id of your form) and see if it resolves. If it works let me know, that put as answer.

  • I took the test but it hasn’t worked yet. From what I understand, if the focus is in the field Testing, when I click the button OK the field loses focus and automatically goes to the method that ajax calls. I think I need to change the way it is now right... don’t use the Event=".

  • 1

    Add the process="@this" in the ajax of the Blur event otherwise it will not process the new value.

  • Same thing yet... :(

  • Solved... I’m no longer using the event="blur". Now it’s being checked in Controller. Thank you

1 answer

0


I couldn’t solve it the way I wanted, I removed the tag p:ajax and now I’m checking on Controller at the time of commit.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.