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
Mahesh MMahesh M 

Can any one help me this scenario

have to dispaly 4 fileds in single row in Opportunity i.e., Opp.Name, Stage, Amount,CloseDate in Opprtunity Edit Page. and Add the " ADD" ,"REMOVE" functionalites in the vf. if i click "ADD " button have to add the one Row( Opp.Name, Stage, Amount,CloseDate).

Thanks & Regards,
Sunil MadanaSunil Madana
Hi Mahesh, 
Below is the code that you asked for.

public class OpptyPopup {
    public List<Opportunity> opptyList {get;set;}
    public List<Opportunity> opptyAddList {get;set;}
    public String opptyName {get;set;}   
    public OpptyPopup() {
        String sql = 'SELECT Name,StageName,Amount,CloseDate FROM Opportunity';
        opptyList = Database.Query(sql);
        opptyAddList = new List<Opportunity>();
        opptyAddList.add(new Opportunity());
    public void AddRow() {
        opptyAddList.add(new Opportunity());
<apex:page sidebar="false" controller="OpptyPopup">
    <apex:form >
        <apex:pageBlock id="membAdd" >                  
            <apex:pageblockSection >
                <apex:pageBlockTable value="{!opptyAddList}" var="memb">
                    <apex:column headerValue="Opportunity Name">
                        <apex:inputField value="{!memb.Name}"/>
                    <apex:column headerValue="Opportunity Stage">
                        <apex:inputField value="{!memb.StageName}"/>
                    <apex:column headerValue="Opportunity Amount">
                        <apex:inputField value="{!memb.Amount}"/>
                    <apex:column headerValue="Opportunity Close Date">
                        <apex:inputField value="{!memb.CloseDate}"/>
                <br/><apex:commandLink value="+ Add Row" action="{!addRow}" reRender="membAdd"/>        
            <apex:pageblockSection columns="1" >
                <apex:pageblockSectionItem >
                    <apex:commandButton value="Save" /><apex:commandButton value="Cancel" />
Appreciate your feedback to this answer, if it helps.
Thanks, Sunil.