0

Currently, when 'Save' is selected, SF directs to the new record. As our form will be filled out by external guests without a login, we want to be able to direct to another VF page that states 'Your submission was successful' when the form is saved. I do not want a pop-up message/alert here.

My controller is named Intake__c. My main VF page is named Intake. My secondary VP page I want to direct to on save is named Congratulations.

I know I'll need to create a controller extension, but I'm having trouble with what to put there for the redirect to function properly. It also looks like an extension is created by creating a new Apex Class in the Developer Console and referencing in the tag on the VF page - Is this correct? SF's notes werern't super clear here.

Here is my VF page code currently;

<apex:page standardController="Intake__c" standardStyleSheets="false" showHeader="false" sidebar="false">
    
  
  <link REL="Favicon" HREF="{!URLFOR($Resource.favicon)}"/>  
  <apex:stylesheet value="{!$Resource.styleForIntake}"/>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
   
  
  
<body>
<!-- multistep form -->
<apex:form Id="msform" styleClass="form">
  <!-- progressbar -->
  <br></br><br></br>
  <ul id="progressbar">
    <li class="active">Client Info</li>
    <li>Residence </li>
    <li>Tech Recom.</li>
  </ul>
  <!-- fieldsets -->
 <br></br><br></br>
   <fieldset>
   <br></br><br></br>
    <h2 class="fs-title">Client Information</h2> 
    <h3 class="fs-subtitle">Here, we will gather information specific to the client.</h3> <br></br>
    <p>  
        Client Name (First and Last Initial): <br></br> 
     </p>
        <apex:inputField styleClass="fieldset" label="Client Name (First and Last Intial):" value="{!Intake__c.Client_Name_First_and_Last_Initial__c}"/> 
    <br></br> <br></br>
     <p>  
        Client Preferred Pronouns: <br></br> 
     </p>
    <div class="pronoun">
        <apex:inputField styleClass="fieldset" value="{!Intake__c.Preferred_Pronouns__c}"/>
    </div>
    <br></br> <br></br>
     <p>  
        Client Communicates With (Select all that Apply):
     </p>
    <div class="selectiondiv">
        <apex:inputField styleClass="fieldset" value="{!Intake__c.This_Person_Communicates_With__c}"/>
    </div>
    <br></br> <br></br>
    
   
    <br></br> <br></br><br></br> <br></br>
    <input type="button" name="next" class="next action-button" value="Next" />
    </fieldset >
    
    
   <fieldset>
    <h2 class="fs-title">Residence Information</h2>
    <h3 class="fs-subtitle">Here we will ask for information on the residence where the technology will be used.</h3>
    <br></br> <br></br>

    <p>  
        Type of Residence: <br></br> 
    </p>
     <div class="selectiondiv">
        <apex:inputField styleClass="fieldset" value="{!Intake__c.Residence_Type__c}">
        </apex:inputField>
     </div>
    
    
    <br></br> <br></br><br></br> <br></br>
    <input type="button" name="previous" class="previous action-button" value="Previous" />
    <input type="button" name="next" class="next action-button" value="Next" />
    </fieldset>
          
  
      <fieldset>
    <h2 class="fs-title">Technology Recommendation</h2>
    <h3 class="fs-subtitle">Based on your selections for 'Concerns Addressed', we recommend the following technology:</h3>
           
           <apex:pageblock id="seizures">
               <apex:outputText rendered="{!IF(CONTAINS(Intake__c.Population__c, 'Epilepsy/Seizures'), 'true', 'false')}" value="SimplyHome does not currently support Epilepsy/Seizure-detecting technology. However, we may be able to asssist with additionally noted concerns."/>
           </apex:pageblock>
           
           <apex:pageblock id="technologyRecommendation">
           
           
            <apex:pageblockSection >
            <apex:outputText rendered="{!IF(!CONTAINS(Intake__c.Personal_Care__c,"Toileting/Bathing/Self-Care in Bathroom"), "true", "false")}" value="    SimplyHome System"/>
          </apex:pageblockSection>
          
      
        </apex:pageblock>
    <br></br> <br></br><br></br> <br></br>
    <input type="button" name="previous" class="previous action-button" value="Previous" />

    <apex:commandButton action="{!save}" styleClass="submit action-button" style="width=100px" value="Submit" id="saveButton" />
     </fieldset>
     
     
     <fieldset>
           <p> Thank you for your submission </p>
           
     </fieldset> 
    
 
</apex:form>

<script>
//jQuery time




var current_fs, next_fs, previous_fs; 
var left, opacity, scale; 
var animating; 





$(".next").click(function(){
    if(animating) return false;
    animating = true;
    
    current_fs = $(this).parent();
    next_fs = $(this).parent().next();
    
    $("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
    
    next_fs.show(); 
    current_fs.animate({opacity: 0}, {
        step: function(now, mx) {
            scale = 1 - (1 - now) * 0.2;
            opacity = 1 - now;
            current_fs.css({
        'transform': 'scale('+scale+')'
      });
            next_fs.css({'left': left, 'opacity': opacity});
        }, 
        duration: 800, 
        complete: function(){
            current_fs.hide();
            animating = false;
        }, 
        
    });
});

$(".previous").click(function(){
    if(animating) return false;
    animating = true;
    
    current_fs = $(this).parent();
    previous_fs = $(this).parent().prev();
    
    $("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active");
    
    previous_fs.show(); 
    current_fs.animate({opacity: 0}, {
        step: function(now, mx) {
            scale = 0.8 + (1 - now) * 0.2;
            opacity = 1 - now;
            current_fs.css({'left': left});
            previous_fs.css({'transform': 'scale('+scale+')', 'opacity': opacity});
        }, 
        duration: 800, 
        complete: function(){
            current_fs.hide();
            animating = false;
        }, 
     
    });
});




$(document).ready(function () {
$("#datepicker2").datepicker({
dateFormat: "mm/dd/yy",
changeMonth: true,
changeYear: true,
yearRange: "-100:+0"
});

});


$(document).ready(function () {
$("#datepicker").datepicker({
dateFormat: "mm/dd/yy",
changeMonth: true,
changeYear: true,
yearRange: "-100:+0"
});

});
0

I created a controller extension and called it within my VF page.

The header became :

<apex:page standardController="Intake__c" extensions="IntakeExtension" standardStyleSheets="false" showHeader="false" sidebar="false">

and I created an Apex Class to be an extension of Intake that looks like this:

public with sharing class IntakeExtension {
    public IntakeExtension(ApexPages.StandardController Intake) {
    }
    public PageReference save() {
        return Page.Congratulations;
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.