I now have problem with using confirmDialog inside tabView. Here is my confirmDialog
<p:confirmDialog global="true" showEffect="fade" hideEffect="explode">
<h:form>
<p:commandButton value="Yes" type="button"
styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="No" type="button"
styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</h:form>
</p:confirmDialog>
In the 1st tabView, I have a button with confirmation
<p:commandButton value="Import" icon="ui-icon-arrowrefresh-1-w"
update=":form:growl">
<p:confirm header="Confirmation" message="Are you sure?" />
</p:commandButton>
In the 2nd tabView, I have exactly that button.
And now my problem is: In the 1st tab, my confirmDialog have full text as I want: header and message, however in the 2nd tab, the header and message all become "null". Only button yes and no of confirmDialog still work. I don't know what is happening, please help me, how to make confirmDialog display full content in all tabView
p:confirm does not implement state saving, thus it loses its attributes' values after the first JSF lifecycle. It also evaluates EL only once at view build time.
How to fix state saving.
You can extends PrimeFaces'
ConfirmBehavior
, implementsaveState
,restoreState
, and override the original behavior in faces-config.xml by behavior-idorg.primefaces.behavior.ConfirmBehavior
. Then you'll be able to render and re-render p:confirm on subsequent requests.How to fix state saving and reevaluate EL bound attribute values.
You should create your own my:confirm, because you need a custom taghandler, and you can't substitute a taghandler of another taglibrary's tag in a non-ugly way.
Create ConfirmBehavior.
Create ConfirmBehaviorHandler.
Register ConfirmBehavior in faces-config.xml.
Register ConfirmBehaviorHandler in your taglibrary my.taglib.xml.
Now you can use my:confirm, just as you would use p:confirm, but with state saving and dynamic EL evaluation.
I had the same problem with the component. The proposed solution of removing the dynamic true works, but when we have to work in a dialog does not meet because the data are no longer updated automatically resulting in that the fields are blank. If this happens you must perform the following action. Ex:.
It seems to work ok for me. See example below
Output:
It would be good if you post your full xhtml code so we can see what could be the problem there.