function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
S SaiS Sai 

No Need to move accout Object Page

<!---Page---->
<apex:page standardController="account" sidebar="false" showHeader="false">
<!----- Form --->
    <apex:form id="ChangeStatusForm">
        <apex:pageBlock >
                <!----PAGE BLOCK ONE ------->
                <apex:pageBlockSection title="ACCOUNT DETAILS">
                <apex:inputField value="{!account.name}"/>
                <apex:inputField value="{!account.accountnumber}"/>
                <apex:inputField value="{!account.rating}"/>
                <apex:inputField value="{!account.industry}"/>
                </apex:pageBlockSection>
                
                <!---- PAGE BLACK TWO ------>
                <apex:pageBlockSection title="Category Details">
                <apex:inputField value="{!account.type}"/>
                <apex:inputField value="{!account.annualrevenue}"/>
                </apex:pageBlockSection>
            </apex:pageBlock>
        
                <!---- BUTTON ------->
                <div align="Center" draggable="false" >
                    <apex:commandButton value="SAVE" action="{!SAVE}"/>
                            </div>
    </apex:form>
</apex:page>
User-added image
When I am saving the account it's move to account object
I dont Want to move the account object. when i am saving the to stay the same page
How Plz Help....




 
Best Answer chosen by S Sai
Keyur  ModiKeyur Modi
Hi,
Do the changes in the class as mention below:-
public class exttion1 {
public Account account{get;set;}

    public exttion1(ApexPages.StandardController controller) {
    doNull();
    }
    public void doNull(){
     account = new Account();
    }
    public PageReference doSave(){
    insert account;
     doNull();
    return null;
    }
}

Thanks,
Keyur Modi
 

All Answers

Keyur  ModiKeyur Modi
Hi,
You can use belove code in place of save method.

public pagerefrance save(){
// DML operation
return null;
}

Thanks,
Keyur Modi
anand k 11anand k 11
Hi,

You can try using extension controller 


public with sharing class SaveAndReturnController
{    
private ApexPages.StandardController controller;
 public SaveAndReturnController(ApexPages.StandardController controller)  

  {    
this.controller = controller;  
  }    


public PageReference saveAndReturn()  

  {      
  PageReference cancel = controller.cancel();        
controller.save();      
  return cancel;     } }


<apex:page standardController="Test__c" extensions="SaveAndReturnController" tabStyle="Test__c">

<apex:page standardController="Test__c" extensions="SaveAndReturnController" tabStyle="Test__c">


Thanks
Anand
S SaiS Sai
HI Modi,

Thx For replying could u plz explain clearly with code. Here I am Using standard controller


 
Keyur  ModiKeyur Modi
Hi,
use below code,that will help you .
<!---Page---->
<apex:page standardController="account" sidebar="false" showHeader="false" extensions="exttion1">
<!----- Form --->
    <apex:form id="ChangeStatusForm">
        <apex:pageBlock >
                <!----PAGE BLOCK ONE ------->
                <apex:pageBlockSection title="ACCOUNT DETAILS">
                <apex:inputField value="{!account.name}"/>
                <apex:inputField value="{!account.accountnumber}"/>
                <apex:inputField value="{!account.rating}"/>
                <apex:inputField value="{!account.industry}"/>
                </apex:pageBlockSection>
                
                <!---- PAGE BLACK TWO ------>
                <apex:pageBlockSection title="Category Details">
                <apex:inputField value="{!account.type}"/>
                <apex:inputField value="{!account.annualrevenue}"/>
                </apex:pageBlockSection>
            </apex:pageBlock>
        
                <!---- BUTTON ------->
                <div align="Center" draggable="false" >
                    <apex:commandButton value="SAVE" action="{!doSave}"/>
                            </div>
    </apex:form>
</apex:page>

=======================================

public class exttion1 {
public Account account{get;set;}

    public exttion1(ApexPages.StandardController controller) {
    account = new Account();
    }
    public PageReference doSave(){
    insert account;
    return null;
    }
}

Thanks,
Keyur Modi
S SaiS Sai
Hi Modi
When i am in insert the new data Here Not Clear the data
THANKS
SS
Keyur  ModiKeyur Modi
Hi,
Do the changes in the class as mention below:-
public class exttion1 {
public Account account{get;set;}

    public exttion1(ApexPages.StandardController controller) {
    doNull();
    }
    public void doNull(){
     account = new Account();
    }
    public PageReference doSave(){
    insert account;
     doNull();
    return null;
    }
}

Thanks,
Keyur Modi
 
This was selected as the best answer
S SaiS Sai
Hi MODI,
Thank U Very Much

One More Doubt
i Want to create account related contact in Table Format

THANKS,
SS
 
S SaiS Sai
HI Modi,

How to create account related contact  (Table format ) in visualforce Page