0

UPDATE

I am working to add a controller and this is what I have:

enter image description here

I am getting an error on Intake.Intake__c - I know this is supposed to be PageReference, but how do I call this? My standard controller is Intake__c, and my page name is Intake. Thank you!


I have a submit button on my VisualForce page, and I want to show a 'Submit Successful' message if a new object is successfully created, and an error message when it is not.
I'm not sure I actually even have it set to create a new record when Submit is clicked..

Any help, rather than redirections, is appreciated. I've looked here and was not able to solve on my own.

My submit button and JS code is here:

       </apex:pageblock>
    <br></br> <br></br><br></br> <br></br>
    <input type="button" name="previous" class="previous action-button" value="Previous" />

    <apex:commandButton styleClass="submit action-button" style="width=100px" value="Submit" id="saveButton" action="{!save}" />
     </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;
        }, 
     
    });
});

$(".submit").click(function(){
    return 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"
});

});

</script>
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;
    }
}

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