You need to sign in to do that
Don't have an account?
Lavanya Ponniah 3
What mistake in this?
public class productExtension
{
public productExtension(){
cPro = [SELECT Id, Products__c FROM Product_Services__c where ID =:ApexPages.currentPage().getParameters().get('id')];
System.debug('=========================================Products'+cPro);}
public PageReference cancel() {
return null;
}
public Product_Services__c cPro {get; set;}
public PageReference SubmitPRoduct()
{
update cPro;
Quick_Contact__c con = new Quick_Contact__c();
con.Choose_Area_of_Interest__c = cPro.Products__c ;
insert con;
System.debug('==========================================='+con);
PageReference pageRef=Page.Quick_Contact;
pageRef.setRedirect(false);
return pageRef;
}
}
<apex:page Controller="productExtension" standardStylesheets="false" showHeader="true" sidebar="false" >
<style>
.activeTab {background-color: #236FBD; color:white;
background-image:none}
.inactiveTab { background-color: Magenta; color:black;
background-image:none}
</style>
<apex:form >
<apex:pageBlock title="" >
<apex:image value="{!$Resource.ReveSoftLogo}" style="border:none;"/>
<!-- <p style="color:orange;font-size:30px;"></p> -->
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Submit " action="{!SubmitPRoduct}"/>`
<apex:commandButton value="Cancel" action="{!cancel}"/>
<apex:commandButton value="Back" action="/"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1" >
<apex:inputfield value="{!cPro.Products__c}" /><br/>
<apex:inputfield value="{!cPro.Mobile_VoIP__c}" /><br/>
<apex:inputfield value="{!cPro.Softswitch_Billing__c}" /><br/>
<apex:inputfield value="{!cPro.Other__c}" /><br/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
{
public productExtension(){
cPro = [SELECT Id, Products__c FROM Product_Services__c where ID =:ApexPages.currentPage().getParameters().get('id')];
System.debug('=========================================Products'+cPro);}
public PageReference cancel() {
return null;
}
public Product_Services__c cPro {get; set;}
public PageReference SubmitPRoduct()
{
update cPro;
Quick_Contact__c con = new Quick_Contact__c();
con.Choose_Area_of_Interest__c = cPro.Products__c ;
insert con;
System.debug('==========================================='+con);
PageReference pageRef=Page.Quick_Contact;
pageRef.setRedirect(false);
return pageRef;
}
}
<apex:page Controller="productExtension" standardStylesheets="false" showHeader="true" sidebar="false" >
<style>
.activeTab {background-color: #236FBD; color:white;
background-image:none}
.inactiveTab { background-color: Magenta; color:black;
background-image:none}
</style>
<apex:form >
<apex:pageBlock title="" >
<apex:image value="{!$Resource.ReveSoftLogo}" style="border:none;"/>
<!-- <p style="color:orange;font-size:30px;"></p> -->
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Submit " action="{!SubmitPRoduct}"/>`
<apex:commandButton value="Cancel" action="{!cancel}"/>
<apex:commandButton value="Back" action="/"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1" >
<apex:inputfield value="{!cPro.Products__c}" /><br/>
<apex:inputfield value="{!cPro.Mobile_VoIP__c}" /><br/>
<apex:inputfield value="{!cPro.Softswitch_Billing__c}" /><br/>
<apex:inputfield value="{!cPro.Other__c}" /><br/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
You need to pass ID as parameter on URL while calling this vf page from other place. So from the controller it wil get the id from url by this ApexPages.currentPage().getParameters().get('id').
Then only query will retrieve the data based on id.
Eg:
Eg:]
if your page page name is myvfPage
you are calling the is page from other cotroller ex: "apex/?id=value"
cPro = [SELECT Id, Products__c FROM Product_Services__c where ID =:ApexPages.currentPage().getParameters().get('id')];
Mark it as best answer if its helps.
Thanks.
Praveen Murugesan.
All Answers
And which line you are getting error ?
Furthermore, have you looked into using the StandardController, and re-writing your controller as an actual extension class? http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_extension.htm Using the examples in the link, you'll find that your code will be cleaner.
You need to pass ID as parameter on URL while calling this vf page from other place. So from the controller it wil get the id from url by this ApexPages.currentPage().getParameters().get('id').
Then only query will retrieve the data based on id.
Eg:
Eg:]
if your page page name is myvfPage
you are calling the is page from other cotroller ex: "apex/?id=value"
cPro = [SELECT Id, Products__c FROM Product_Services__c where ID =:ApexPages.currentPage().getParameters().get('id')];
Mark it as best answer if its helps.
Thanks.
Praveen Murugesan.