0
<apex:page standardcontroller="product2" extensions="Details" showHeader="true">
<apex:form >

<apex:pageBlock mode="edit">

    <apex:pageBlockSection >
        <apex:inputfield value="{!product2.Name}"/>
        <apex:inputfield value="{!product2.IsActive}"/> 
        <apex:inputText value="{!Price}" label="Product Price"/>
        <apex:inputText value="{!Quantity}" label="Quantity"/>
        <apex:inputfield value="{!product2.ProductCode}"/>  
        <apex:inputText value="{!BarcodeId}" label="Barcode Id"/>        
        <apex:inputText value="{!Categories}" label="Categories"/>     
        <apex:inputText value="{!Location}" label="Warehouse Location"/> 
        <apex:inputText value="{!Expired}" label="Expiry Date"/>  
        <apex:inputText value="{!Manufatured}" label="Manufactured Date"/> 
    </apex:pageBlockSection>

    <apex:pageBlockButtons location="both">
        <apex:commandButton action="{!save}" value="Save"/>
        <apex:commandButton action="{!savenew}" value="Save&New"/>
        <apex:commandButton action="{!cancel}" value="Cancel"/>
    </apex:pageBlockButtons>

</apex:pageBlock>

</apex:form>
</apex:page>

public class Details 
{
//private ApexPages.StandardController controller;
    public  product2 pro{get;set;}
    public string BarcodeId{get;set;}
    public string Categories{get;set;}
    public date Expired{get;set;}
    public date Manufatured{get;set;}
    public integer Price{get;set;}
    public string Quantity{get;set;}
    public string Location{get;set;}
    public Details(ApexPages.StandardController controller) 
    {
        pro = new product2();
    }

    public pagereference savenew()
    {
        insert pro;
        PageReference acctPage =ApexPages.currentPage();
        acctPage.setRedirect(true);
        return acctpage;
    }

}
  • What is the difference you see with and without override? Try changing the page and see if your changes are getting reflected. – Raul Nov 7 '16 at 9:28
  • Its same there is no difference – venkatesh Nov 7 '16 at 9:39
2

Try overridding add button instead of new:

enter image description here

| 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.