Hi Ola Bamidele, Try Changing the Save method to this. It is working fine in my Org.
public PageReference Save() {
PageReference detailPage = sc.Save();
if (detailPage != null) {
PageReference editPage = new PageReference(Label.websiteurl);
return editPage ;
} else {
return detailPage;
}
}
Note: When you will give the website Url in Custom Label, give the complete link. Eg :
Hope it Helps you. Please mark this as solved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.http://www.google.com
Regards ,
Suraj
Hi Ola Bamidele,
I have made the change in your code and it is working fine in my Org.
VisualForce Page :
<apex:page standardController="Turndown__c" sidebar="false" showHeader="true" extensions="extencntrl" >
<apex:form >
<apex:pageBlock title="Documented Turndowns" id="turndown_list">
<apex:pageBlockSection columns="1" >
<style type="text/css">
.bPageHeader {display: none;}
</style>
<apex:inputfield value="{! Turndown__c.Account__c }"/>
<apex:inputfield value="{! Turndown__c.Phone_Number__c }"/>
<apex:inputfield value="{! Turndown__c.Region__c }"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<!--<apex:actionStatus id="go">
<apex:facet name="stop">
<apex:commandButton value="Save" action="{!showPopup}" status="go" disabled="false" rerender="go"/>
</apex:facet>
<apex:facet name="start">
<apex:commandButton status="go" value="Saving..." disabled="true" rerender="tstpopup"/>
</apex:facet>
</apex:actionStatus>-->
<apex:commandButton value="Save" action="{!showPopup}" status="go" disabled="false" rerender="tstpopup"/>
<apex:outputPanel id="tstpopup">
<apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
Thank you, you have successfully submitted the form <br/><br/><br/>
<apex:commandButton value="Close" action="{!Save}" rerender="tstpopup"/>
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
<style type="text/css">
.custPopup{
background-color: white;
border-width: 2px;
border-style: solid;
z-index: 9999;
left: 50%;
padding:10px;
position: absolute;
width: 500px;
margin-left: -250px;
top:100px;
}
.popupBackground{
background-color:black;
opacity: 0.20;
filter: alpha(opacity = 20);
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 9998;
}
</style>
</apex:page>
Apex Class :
Screenshot :public with sharing class extencntrl{
private ApexPages.StandardController sc;
public extencntrl(ApexPages.StandardController sc) {
this.sc = sc;
}
public boolean displayPopup {get; set;}
public void closePopup() {
displayPopup = false;
}
public void showPopup() {
displayPopup = true;
}
public PageReference Save() {
PageReference detailPage = sc.Save();
if (detailPage != null) {
PageReference editPage = new PageReference(detailPage.getUrl() + '/e');
return detailPage ;
} else {
return null;
}
}
}
Hope it Helps you. Please mark this as solved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Regards ,
Suraj
Hi Suraj Tripathi, Do you know how I can redirect to another visualforce instead of the "Label.Website" (which is a webpage)?Is it as simple as I will need to put the visualforce page name in the body of the labelI created?Or will I need to do something else aswell?Thanks Thank you, Ola Bamidele for selecting my answer as best. It's my pleasure to help you. Hi Suraj,Yes thanks the pop up is now working. However after the record is saved, the page is suppose to be redirected to the "Label.WebsiteURL" inside the the New PageReference. How can I add the "Label.WebsiteURL" to the code so that it will be redirected to the website after the record is saved? Thanks very much! Hi Suraj,Thanks for the reply but your code doesnt work. I firstly cant change my standard controller as that will could my form to stop working correctly. If you could make the additional changes to the original code I posted that would be great as youll understand better, thanks! Hi Ola Bamidele, I have made few code changes. I have made a class with name Accounttest.
VisualForce Page :
<apex:page controller="Accounttest">
<apex:form >
<apex:commandButton value="Show Pop up" action="{!showPopup}" rerender="tstpopup"/>
<apex:pageBlock >
This is just filler text from the Salesforce General.
</apex:pageBlock>
<apex:outputPanel id="tstpopup">
<apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
This is where I would put whatever information I needed to show to my end user.<br/><br/><br/>
<apex:commandButton value="Hide Pop up" action="{!closePopup}" rerender="tstpopup"/>
</apex:outputPanel>
</apex:outputPanel>
</apex:form>
<style type="text/css">
.custPopup{
background-color: white;
border-width: 2px;
border-style: solid;
z-index: 9999;
left: 50%;
padding:10px;
position: absolute;
/* These are the 3 css properties you will need to change so the popup
displays in the center of the screen. First set the width. Then set
margin-left to negative half of what the width is. You can add
the height property for a fixed size pop up if you want.*/
width: 500px;
margin-left: -250px;
top:100px;
}
.popupBackground{
background-color:black;
opacity: 0.20;
filter: alpha(opacity = 20);
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 9998;
}
</style>
</apex:page>
Apex Class :
Screenshot :public class Accounttest {
public boolean displayPopup {get; set;}
public void closePopup() {
displayPopup = false;
}
public void showPopup() {
displayPopup = true;
}
}
Hope it Helps you. Please mark this as solved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Regards ,
Suraj
Hi Suraj Tripathi,Thanks for you response however when I enter the Outputpanel, I get an error saying:“Unknown property 'Turndown__cStandardController.displayPopUp” Hi ChandanBiswas,Thanks for your response however I tried the code and it didn’t work – though it saved correctly.
12 answers