You need to sign in to do that
Don't have an account?
student
How to include a Standard Button
Hi,
I've made a new visualforce page for an object. As controller of this page, i made a new apex class with some additional methods...
Now I want to include the standard button "New" of this object in my own visualforce page. But everytime I include
<apex:commandButton value="blabla" action="{!New}"/>
to my page, the error "Unknown Method 'Controller.New()' " occurs.
Does anybody have an idea how to include the standard button otherwise?
Thanks in advance!
Phil
Hello Student;
In order to use the standard buttons as in your page you need to have a standard controller. This is the Object type that you need to create.
If you need to create a new Opportunity and the name of your controller is "MyController" you can do something like below. Remember the method to create a new object is not {!new} but {!create}.
<apex:page standardController="Opportunity" extensions="MyController">
<apex:form>
<apex:commandButton value="blabla" action="{!create}"/>
</apex:form>
</apex:page>
All Answers
Hello Student;
In order to use the standard buttons as in your page you need to have a standard controller. This is the Object type that you need to create.
If you need to create a new Opportunity and the name of your controller is "MyController" you can do something like below. Remember the method to create a new object is not {!new} but {!create}.
<apex:page standardController="Opportunity" extensions="MyController">
<apex:form>
<apex:commandButton value="blabla" action="{!create}"/>
</apex:form>
</apex:page>
Hi prageeth,
thanks for your answer :-)