0

Visual force Page standard Controller code:

<apex:page standardController="Account">
<apex:commandButton action="{!Cancel}" value="Back"/>
<apex:commandButton action="{!Save}" value="Save" />

The above code is Standard Controller Code, which contains standard commandbutton action such as cancel and save

custom object:

<apex:page standardController="Visit__c">
<apex:commandButton action="{!Cancel}" value="Back"/>
<apex:commandButton action="{!SaveNavigate}" value="Save">

The above code contains save and Navigate Option,how they are adding functionality of action called {!SaveNavigate} Manually in custom object.

  • What is your question, exactly? That second example won't work without a controller extension defined... – Adrian Larson Sep 7 '16 at 12:43
  • cancel and save command button belongs to account object,how save and navigate action is Created customally in that custom object How? – SFDC Sep 7 '16 at 12:44
  • Your examples are invalid. Every StandardController has the same methods, and saveNavigate is not one of them. The second <apex:page> tag should have an extensions attribute. Where are you getting these examples from? – Adrian Larson Sep 7 '16 at 12:46
  • or Save and Navigate is a Variable – SFDC Sep 7 '16 at 12:46
1

Every StandardController has the same available methods, and SaveNavigate is not one of them. In order to define such a method, you would need to Build a Controller Extension. Without specifying the extensions attribute on your <apex:page>, your included examples should fail to compile.

Markup

<apex:page standardController="MyObject__c" extensions="MyExtension">
    <apex:form>
        <apex:commandButton value="Custom" action="{!saveNavigate}" />
    </apex:form>
</apex:page>

Code

public with sharing class MyExtension
{
    public MyExtension(ApexPages.StandardController controller)
    {
        // any necessary constructor logic
    }
    public PageReference saveNavigate()
    {
        // do stuff
    }
}
| improve this answer | |

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.