-
1. Re: Confirmation dialog using Rich componentControl
danielc.roth Oct 17, 2008 10:08 AM (in response to valatharv)This is a more a richfaces question... but the s:button makes me forced to answer ;-)
A button by default submits the form. Even if s:button doesn't do it, it will do a postback...
I suggest you try a commandButton in its own form and force it to not postback (something like h:form onsubmit="return false")
or
Skin the link as a button :-)
-
2. Re: Confirmation dialog using Rich componentControl
danielc.roth Oct 17, 2008 10:10 AM (in response to valatharv)oh, you could use an a4j:commandButton. It will just do an ajax postback...
-
3. Re: Confirmation dialog using Rich componentControl
valatharv Oct 17, 2008 6:04 PM (in response to valatharv)Thank you for replying and helping on this, I tried but no success, here is the output:
a) If I click on "Delete this" BUTTON nothing happens.
b) If I click "Delete" LINK, rich:modalPanel pops up, with "Yes", "No" button, clicking on Yes or No does not close the model panel , nothing happens....
I am new to all this, please suggest what should I change in the code, so that when user click No, it should hide the model panel and show parent page...
xhtml
-----
<ui:define name="body">
<h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
<h:form id="listTest" styleClass="edit">
<s:decorate id="affinityCompoundDecoration" template="layout/edit.xhtml">
<ui:define name="label">Affinity Compound</ui:define>
<h:inputText id="affinityCompound"
required="true" value="Test Affinity"/>
</s:decorate>
.... other fields
<f:subview xmlns="http://www.w3.org/1999/xhtml"
..
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<rich:modalPanel id="panel" width="350" height="100">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="Confirmation Message"></h:outputText>
</h:panelGroup>
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<h:graphicImage value="/images/modal/close.png" style="cursor:pointer" id="hidelink"/>
<rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
</h:panelGroup>
</f:facet>
<a4j:commandButton id="delete" value="Yes" action="#{studyHome.remove}" immediate="true"/>
<a4j:commandButton id="cancel" value="No" propagation="end"/>
</rich:modalPanel>
<a4j:commandButton value="Delete this" id="button">
<rich:componentControl for="panel" attachTo="link" operation="show" event="onclick"/>
</a4j:commandButton>
<h:outputLink value="#" id="link">
Delete
<rich:componentControl for="panel" attachTo="link" operation="show" event="onclick"/>
</h:outputLink>
</f:subview>
</h:form>
</ui:define> -
4. Re: Confirmation dialog using Rich componentControl
danielc.roth Oct 18, 2008 12:19 PM (in response to valatharv)you don't happen to run jboss as 4.2.3 (or some other as with jsf 1.2.09?)
-
5. Re: Confirmation dialog using Rich componentControl
valatharv Oct 18, 2008 5:15 PM (in response to valatharv)I am using jboss-4.2.3, jboss-seam-2.0.2.SP1.
Created the project using seam generate-ui... anything else I should check ? -
6. Re: Confirmation dialog using Rich componentControl
danielc.roth Oct 18, 2008 9:44 PM (in response to valatharv)Might be this bug in Sun JSF RI:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=144138
Replace the jsf-libs in jboss 4.2.3 for those in 4.2.2 (or just downgrade to 4.2.2)
-
7. Re: Confirmation dialog using Rich componentControl
valatharv Oct 18, 2008 9:53 PM (in response to valatharv)Thanks Daneil for the link, we can't downgrade... we will try some other option...
-
8. Re: Confirmation dialog using Rich componentControl
danielc.roth Oct 18, 2008 11:41 PM (in response to valatharv)Replace the jsf-libs in the jboss then :-)
-
9. Re: Confirmation dialog using Rich componentControl
thetikigod.tiki_god.mail.com Dec 16, 2008 3:22 PM (in response to valatharv)I have successfully done what I think you are trying to do. Im using modal panels for my input forms and confirmations and I am using buttons and not links. Here is what I did for delete:
Snippet from console.xhtml (displays users and actions that can be performed). Near the bottom are the buttons that open the confirmation modals:
<rich:tab label="User Manager"> <ui:include src="userModalPanels.xhtml"></ui:include> <h:form> <p><a4j:commandButton value="New User" action="#{usermanager.init}" oncomplete="Richfaces.showModalPanel('createUserPanel');" /></p> <rich:dataTable id="usersTable" value="#{foundUsers}" var="user" rows="10"> <f:facet name="header"> <rich:datascroller id="userTableScroller1" for="usersTable" ajaxSingle="false" reRender="userTableScroller2" /> </f:facet> <rich:column> <f:facet name="header"><h:outputText value="User ID" /></f:facet> <h:outputText value="#{user.userId}" /> </rich:column> <rich:column> <f:facet name="header"><h:outputText value="Last Name" /></f:facet> <h:outputText value="#{user.lastName}" /> </rich:column> <rich:column> <f:facet name="header"><h:outputText value="First Name" /></f:facet> <h:outputText value="#{user.firstName}" /> </rich:column> <rich:column> <f:facet name="header"><h:outputText value="Phone" /></f:facet> <h:outputText value="#{user.phone}" /> </rich:column> <rich:column> <f:facet name="header"><h:outputText value="Email" /></f:facet> <h:outputText value="#{user.email}" /> </rich:column> <rich:column> <f:facet name="header"><h:outputText value="Actions" /></f:facet> <a4j:commandButton value="Edit" action="#{usermanager.init}" oncomplete="Richfaces.showModalPanel('editUserPanel');" reRender="userInfoToEdit" /> <a4j:commandButton value="Delete" action="#{usermanager.init}" oncomplete="Richfaces.showModalPanel('deleteUserPanel');" reRender="userInfoToDelete" /> </rich:column> <f:facet name="footer"> <rich:datascroller id="userTableScroller2" for="usersTable" ajaxSingle="false" reRender="userTableScroller1" /> </f:facet> </rich:dataTable> </h:form> </rich:tab>
Modal Panel Confirmation:
<rich:modalPanel id="deleteUserPanel" autosized="true"> <f:facet name="header"> <h:panelGroup> <h:outputText value="Delete User" /> </h:panelGroup> </f:facet> <f:facet name="controls"> <h:panelGroup> <h:graphicImage value="/img/close.png" style="cursor:pointer" id="hideDeleteUserPanel" /> <rich:componentControl for="deleteUserPanel" attachTo="hideDeleteUserPanel" operation="hide" event="onclick" /> </h:panelGroup> </f:facet> <s:div id="userInfoToDelete" style="width:250px"> <p><h:graphicImage value="/img/msgwarn.png" /> Are you sure you want to delete '<h:outputText value="#{user.userId}" />'?</p> <h:form> <h:inputHidden id="deleteUserId" value="#{user.userId}" /> <center> <h:commandButton value="Delete" action="#{usermanager.delete}" /> <h:commandButton value="Cancel" action="#{usermanager.cancel}" /> </center> </h:form> </s:div> </rich:modalPanel>
Then here are the init(), delete(), and cancel() methods (part of the usermanager class):
... @Begin public String init() { return null; } ... @End public String delete() { log.warn( "Deleting user: ", this.user.getUserId() ); User tempUser = entityManager.merge( this.user ); this.entityManager.remove( tempUser ); this.find(); this.user = null; return null; } @End public String cancel() { this.user = null; return null; } ...
-
10. Re: Confirmation dialog using Rich componentControl
valatharv Dec 16, 2008 3:40 PM (in response to valatharv)Thanks Josh, seems to be helpful, we will try it soon.
Regards
-
11. Re: Confirmation dialog using Rich componentControl
narvava Jan 3, 2011 12:38 PM (in response to valatharv)<html>
Hi Thanks for your code. But I don't understand how do you get the control from rich:datatable to modalPanel.
I mean...when I use like following code snippet in modalpanel
<p><h:graphicImage value="/img/msgwarn.png" /> Are you sure you want to delete '<h:outputText value="#{user.userId}" />'?</p>
I am getting Target "Unreachable, identifier 'memberdetails' resolved to null" error.
Could you please explain how to the control from the table to modalpanel
</html> -
12. Re: Confirmation dialog using Rich componentControl
kishorereddy84 Sep 10, 2013 8:31 PM (in response to valatharv)<rich:column id="colSearchResultDelete" width="12.5%">
<f:facet name="header">
<h:outputText id="lblSearchResultDelete"
styleClass="epayHLabel" value="#{messages.DELETE}"></h:outputText>
</f:facet>
<rich:modalPanel id="confirmPopUp" width="350" height="100">
<f:facet name="header">
<h:outputText value="Confirm"></h:outputText></f:facet>
<h:outputText value="Are you sure you want to delete"></h:outputText>
<br /><br/>
<a4j:commandButton value="OK" action="#{pc_MaintainDivStore.doBtnDeleteAction}" />
<a4j:commandButton value="Close" onclick="#{rich:component('confirmPopUp')}.hide()"/>
</rich:modalPanel>
<a4j:commandButton type="submit" value="#{messages.DELETE}"
id="btnDelete" styleClass="epayFlatButtonSmall">
<rich:componentControl for="confirmPopUp" attachTo="btnDelete" operation="show" event="onclick"/>
</a4j:commandButton>
</rich:column>