<p:confirmDialog> with a parameter message

UI Components for JSF
Post Reply
asbrana
Posts: 9
Joined: 16 Dec 2009, 14:51

16 Sep 2010, 18:09

Hi,

Is there a way where I can define a parameter message in a <p:confirmaDialog> ?

Let's say I have a message in resource bundle like:

Code: Select all

hello_msg=Hello {0}
and hello.xhtml

Code: Select all

<p:confirmDialog message="#{msgs.hello_ms}"  
	showEffect="bounce" hideEffect="explode"  
	header="Welcome" severity="info" widgetVar="helloDiag" >
    <p:commandButton value="Ok" type="button"  onclick="helloDiag.hide()"/>          
</p:confirmDialog>
Where I define a parameter for that message?

Using a tag from jsf <h:outputFormat> that will be possible.

Code: Select all

<h:outputFormat value="#{msgs['hello_msg']}">
   <f:param value="John" />
</h:outputFormat>
But I would like to know if it is possible with <p:confirmDialog>. Didn't find anything in the documentation.

Thanks,

asbrana
Posts: 9
Joined: 16 Dec 2009, 14:51

24 Sep 2010, 21:39

If somebody is wondering how to solve it, I've found a solution. :D

Code: Select all

<p:confirmDialog 
    showEffect="bounce" hideEffect="explode"  
    header="Welcome" severity="info" widgetVar="helloDiag" >
                   <f:facet name="message">  
			<p:outputPanel>  
			       <h:outputFormat value="#{msgs.hello_ms}" escape="false">
	   				<f:param value="John" />
			       </h:outputFormat>
			</p:outputPanel>  
		   </f:facet>

         <p:commandButton value="Ok" type="button"  onclick="helloDiag.hide()"/>          
</p:confirmDialog>
Cya

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

25 Sep 2010, 09:00

Good thing you've figured out the undocumented message facet feature :)

shuta
Posts: 15
Joined: 25 Dec 2010, 19:20

25 Dec 2010, 20:22

Sorry to bump up this old thread again, but could the "message" facet please be documented in the confirmDialog documentation? It did cost me several hours to get a simple things as a dynamic confirmation message working. I attempted to programmatically call setMessage() and then update the confirm dialog in my xhtml file, but this made the dialog disappear altogether. This thread finally helped me solve my problem. Thanks to asbrana for posting the solution.

andre.hebeler
Posts: 3
Joined: 29 May 2014, 17:08

29 May 2014, 17:14

Hi !

Wy this solution dosen't work for me ?

Code: Select all

<p:commandButton title="#{msg['lista.funcao.excluir']}" icon="ui-icon-trash"
	action="#{permissaoMB.excluirItemMenu(itemMenu)}" update="tabela">
	<p:confirm icon="ui-icon-alert" header="#{msg['msg.confirmaExclusaoItemMenu']}"  />


<p:confirmDialog global="true" showEffect="fade" hideEffect="explode" >
	<f:facet name="message">
		<p:outputPanel>
			<h:outputFormat value="#{msg['msg.exclusaoItemMenu']}" escape="false" />
		</p:outputPanel>
	</f:facet>

	<p:commandButton value="#{msg['btn.ok']}" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
	<p:commandButton value="#{msg['btn.cancelar']}" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</p:confirmDialog>



Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 23 guests