You need to sign in to do that
Don't have an account?

extend VF controller class?
Is it possible to write a class that extends a custom VF controller, and then use the new class as the controller for a page? Can I extend a class that is itself an extension of a standard controller, as opposed to a fully-custom controller?
It's the latter that I'm trying to do right now.
I tried creating an extension. I added the "virtual" keyword to my existing controller, then defined a new child class something like so:
public class CTRL_CustomWizard extends CTRL_FooWizard {
but I get the error "Parent class has no 0-argument constructor for implicit construction"
Does this mean I can't do it, or do I need to do something else? The constructor in the parent class can't have no arguments, because it's an extension of a standard controller, so the constructor is defined like:
public CTRL_FooWizard (ApexPages.StandardController controller) {
Thanks much!
So I think I got this to work. At least I got it to compile.
I used this construction:
public class GPTF_CTRL_NewOpp extends ONEN_CTRL_NewOppWizard { public GPTF_CTRL_NewOpp (ApexPages.StandardController controller) { super (controller); } }
All Answers
Matthew-
Just taking a stab at it:
I wonder if you can do something like in Java, where you'd have to make a call to the parent in the child constructor:
super( <something );
Not sure how to pass the standard controller or how you'd refer to it, but since the superclass requires you to pass something of type ApexPages.StandardController, I wonder if you would need to specify the sObject.
Hope that helps,
David
So I think I got this to work. At least I got it to compile.
I used this construction:
public class GPTF_CTRL_NewOpp extends ONEN_CTRL_NewOppWizard { public GPTF_CTRL_NewOpp (ApexPages.StandardController controller) { super (controller); } }
Hi Sparky.
are you using a standard controller in your FV pages? I am understanding you want extend a standard controller like Account or Contact, so you should have put this on your VF page:
<apex:page standardController="Account" extensions="myExtensionController">
...
</apex:page>
You try to put this on your controller:
public class myExtensionController{
//Case Account
public Account accFinal {get{return this.accFinal;}set;}
//contructor
public myExtensionController(ApexPages.StandardController controller){
this.accFinal = (Account) controller.getRecord();
...
}
...
}
adiez
Salesforce Consulting Partner in Spain
www.proclientia.com
Are there any examples where the standard controller methods are used by an extension controller class where the returned PageReference is not what the standard controller returns?
I'd like to know if I can use the standard controller methods like save but keep control of the UI and not get redirected to the standard SF page returned by the standard controller's save method.
Thanks,
Jason