ConfirmDialog

jQuery UI Widgets
Post Reply
jrgamber
Posts: 13
Joined: 01 Dec 2016, 07:54

02 Dec 2016, 22:59

I have two virtually identical confirmDialog items that are triggered from slightly different places. Both are triggered from Java with

private void promptAlternateUser() {
RequestContext context = RequestContext.getCurrentInstance();
context.execute( "PF('confirmApprove').show();" );
}

and

private void promptWitnessUser() {
RequestContext context = RequestContext.getCurrentInstance();
context.execute( "PF('confirmWitness').show();" );
}


From promptWitnessUser, all the fields of the dialog are available in Java when the p:commandButton action occures. On the other, the fields are not available and are always blank in Java.

Both dialogs use exactly the same bean and the bean is in the session map.

So, obviously confirmDialog works. But I can't find the difference in my code between the ways the one one that works is processed and the one that doesn't work is processed.

Any ideas?

jrgamber
Posts: 13
Joined: 01 Dec 2016, 07:54

03 Dec 2016, 17:32

The test mentioned above were done in Chrome on windows 10.

When running in IE, it is seen via breakpoints in the setter Java method in Glassfish that the setter is called twice, once with the valid value entered in the confirmDialog, the second call to the setter has a null or empty value. I was able to code like:

if (var1 == null || var1.length() == 0)
// do nothing
else
// store the value


This works, at least in IE. However, Chrome returns nothing but null. Also Chrome autofill puts a value into the browsers displayed field, so I suspect autofill may be the problem, although turning it off makes no difference. Odd that two browsers have different behaviors.

The Chrome debugger shows the Primefaces makes some long piece of JavaScript for handling confirmDialog.

This may relate to the JavaScript generated by Primefaces from the <p: confirmDialog> tag library code? This coding may be seriously buggy? Maybe the implementation of confirmDialog needs to be redesigned?

It is also odd that confirmDialog works perfectly in both IE and Chrome on my second use of confirmDialog that contains input fields for the same backing bean. I have several confirmDialogs that just have commandButton and no data entry fields, and they work just fine as all they need to do is trigger the action.

jrgamber
Posts: 13
Joined: 01 Dec 2016, 07:54

08 Dec 2016, 07:28

I changed the <p:confirmDialog> to <p:dialog> and this fixed the issue. Now input fields on the dialog are returned to the bean properly.

I conclude that <p:confirmDialog> should not have input fields, but only <p:commandButton> tags. The confirmDialog should be like Yes or No buttons and a display text "Do you want to proceed".

Post Reply

Return to “PrimeUI”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests