+ Start a Discussion
satakshisatakshi 

Back button is not working on visualforce page

Hello,
I am writing a code whre i want to come back on previous page. but in my case back button is not working. can anyone please help me?

public pageReference CancelAction()
 {
  PageReference pr1 = new PageReference('/apex/SBAddQuestionPage' );
 pr1.setRedirect(true);
 return pr1;



 <apex:commandButton value="Back"  action="{!CancelAction}" styleClass="red-btn" style="margin-left: 113% !important; margin-top: -2% !important; font-weight: bold;"/>   

Thanks & Regards,
Satakshi
YogeshMoreYogeshMore
Hi Satakshi,

Can you share your visualforce page code? It helps to solve your problem.

Regards,
Yogesh More
Salesforce Consultant || Salesforce Developer
 more.yogesh422@gmail.com || +919096872010
www.yogeshmore.com || Skype:-yogesh.more44
 
satakshisatakshi
Here is my code: Add Question #dataSlider{ display:none !important; } .div3{ display:none ;} .div4{ display:none ;} .div5{ display:none ;} .div6{ display:none ;} .div7{ display:none ;} .div8{ display:none ;} .div9{ display:none ;} .div10{ display:none ;} .add2,.add3,.add4,.add5,.add6,.add7,.add8,.add9{ display: inline-block; padding: 3px 15px; line-height: 35px; color: #fff; font-size: 15px; background: #7ff0ff; border-radius: 35px; margin-bottom: 15px; min-width: 125px; text-align: center; } .remove3,.remove4,.remove5,.remove6,.remove7,.remove8,.remove9,.remove10{ display: inline-block; padding: 3px 15px; line-height: 35px; color: #fff; font-size: 15px; background: #7ff0ff; border-radius: 35px; margin-bottom: 15px; min-width: 125px; text-align: center; } .lookupIcon { background-image: url('{!$Resource.LookupIcon}') !important; height:30px !important; width:30px !important; position:absolute !important; top:6px !important; right:-25px !important; } .lookupIconOn { background-image: url('{!$Resource.LookupIcon}') !important; height:30px !important; width:30px !important; position:absolute !important; top:6px !important; right:-25px !important; } .dataSlider{ margin: 40px !important; padding-left:48px; } .questionlabel{ width: 100% !important; margin-left: 25% !important; padding-bottom: 10px !important; }

Add Questions

Question Type


Question
Option One
Option Two
Option Three
Option Four
Option Five
Option Six
Option Seven
Option Eight
Option Nine
Option Ten
Question
Option One
Option Two
Option Three
Option Four
Option Five
Option Six
Option Seven
Option Eight
Option Nine
Option Ten
Question

Question
  • Privacy Policy (#)
  • Terms of Services (#)
YogeshMoreYogeshMore
Hi Satakshi,
 
You have used <apex:form > tag in your visualforce page. Add id attribute in form tag.
Ex: - <apex:form id=”frm”>
 
Then replace

 
<apex:commandButton value="Back"  action="{!CancelAction}" styleClass="red-btn" style="margin-left: 113% !important; margin-top: -2% !important; font-weight: bold;"/>


To following
 
<apex:commandButton value="Back"  action="{!CancelAction}" reRender="frm"
 styleClass="red-btn" style="margin-left: 113% !important; margin-top: -2% !important; font-weight: bold;"/>
Regards,
Yogesh More
Salesforce Consultant || Salesforce Developer
 more.yogesh422@gmail.com || +919096872010
www.yogeshmore.com || Skype:-yogesh.more44