How to run a <p:confirm> through the bean?

Asked

Viewed 191 times

0

My question is: How can I execute one <p:confirm> through the Bean?

I will explain the problem better. During the insertion of a record I need to check if it already exists in the list in which I am entering the CPF. So far so good. I give a message with FacesMessages SEVERITY_ERROR and ready!

But there is a business rule that should check whether in the last 6 months the record, in the CPF case, already participated in another form. In this case the rule says that a question must be asked to the user if he confirms the new insertion.

Well, when I do the Bean check, I don’t know how to render a component on the screen for the user to confirm and continue the processing, ie the insertion of the record in this new form!

It is possible to do this?

1 answer

1


Yes it is possible, follow the code:

public void abrirConfirm() {
    RequestContext.getCurrentInstance().execute("PF('WidgetVarDoDialog').show();");
}

this code serves to open a <p:dialog> also.

  • Rafael, I can capture in Bean which button was pressed, for example if the button was pressed 1 or button 2?

  • Deep inside the confirm you can put two buttons and set one actionListener for each.

  • I did and it worked in parts. It turns out that even doing so I’m not able to divert the flow within the bean and when pressed I don’t, I need to shut down the continuation of the bean. so that the input does not occur. When pressed yes, I must allow.

Browser other questions tagged

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