• Satya413
  • NEWBIE
  • 75 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 18
    Replies
Hi,

I am trying to create a formula field 'Total__c' which has a return type of number. The formula will calculate the sum total value of seven other fields (subject1 marks, subject2 marks ... etc) which are of text type. However, if a student is absent for subject4, the value entered in subject4 field will be 'Absent' and this should be treated as zero while calculating the Total__c. I have written the below formula, but an error pops up saying the character length is too high. Any help is appreciated. 

IF(!ISNUMBER(English__c),0,Value(English__c))+IF(!ISNUMBER(Physics__c),0,Value(Physics__c))+ IF(!ISNUMBER(Maths__c),0,Value(Maths__c))+IF(!ISNUMBER(Chemistry__c),0,Value(Chemistry__c))+ 
IF(!ISNUMBER(Social__c),0,Value(Social__c))+IF(!ISNUMBER(Biology__c),0,Value(Biology__c))+
IF(!ISNUMBER(Economics__c),0,Value(Economics__c))

Thank you,
Satya
Hello All,

I am trying to create a formula field called 'Grade__c' with return type text. Based on the Total Marks (Total__c, return type is number), the grade field should be populated with either A+, A, B+, B, C and D. Say for example, the total marks are 600 0ut of 800, then the grade should be B. Can anyone help me out with this. 

Thank you,
Satya
Hello Everyone, 

I would like to strip the time of the dynamically referenced date field as shown below. Any help is appreciated. 

Controller: 

public class examschedule1_con {

   public exam_schedule__c es {get; set;}
   public list<exam_schedule__c> ess {get; set;}
   public map<string,list<date>> maplist{get; set;}
   
   public examschedule1_con()
   {
     es = new exam_schedule__c();
   }
   
   public void getdata()
   {
     maplist = new map<string,list<date>>();
     
     ess = [select name, startdate__c, enddate__c, starttime__c, endtime__c, year__c, examtype__c, 
           subject1__c, subject2__c, subject3__c, subject4__c, subject5__c, subject6__c, subject7__c 
           from exam_schedule__c where year__c = :es.year__c ];
           
     for(exam_schedule__c e : ess)
     {
        if(!maplist.containskey(e.examtype__c))
        maplist.put(e.examtype__c,new list<date>());
        maplist.get(e.examtype__c).add(e.subject1__c);
        maplist.get(e.examtype__c).add(e.subject2__c);
        maplist.get(e.examtype__c).add(e.subject3__c);
        maplist.get(e.examtype__c).add(e.subject4__c);
        maplist.get(e.examtype__c).add(e.subject5__c);
        maplist.get(e.examtype__c).add(e.subject6__c);
        maplist.get(e.examtype__c).add(e.subject7__c);
     }
   } 
}

VF Page: 

<apex:page controller="examschedule1_con" showHeader="false">
 <apex:form >
  <apex:pageBlock >
   <apex:pageblockSection title="Enter Exam Details">
    <apex:inputfield value="{!es.Year__c}"/>
    <apex:commandButton value="Submit" action="{!getdata}"/>
   </apex:pageblocksection>
  </apex:pageblock>  
  <table border="1" width="600" align="center">
  <th>Exam Type</th>
  <th>Subject1</th>
  <th>Subject2</th>
  <th>Subject3</th>
  <th>Subject4</th>
  <th>Subject5</th>
  <th>Subject6</th>
  <th>Subject7</th>
  <apex:repeat value="{!maplist}" var="key">
  <tr>
  <td>{!key}</td>
  <apex:repeat value="{!maplist[key]}" var="value">
  <td>{!value}</td>
  </apex:repeat>
  </tr>
  </apex:repeat>
  </table>
 </apex:form>
</apex:page>

My Output: 

User-added image

Thank you,
Satya
Hi All,

I have two custom field's of text datatype (Start_Time__c and End_Time__c). I want to put a validation rule so that the start time is always less than end time. Does anyone know how to proceed with this. 

Thank you,
Satya
Hi,

I am trying to display a faculty time table as shown below. I want to know in what way can we link the day with the period timings. Below is my code.
 
User-added image

VF Page: 

<apex:page controller="FacultyTimeTable_con" sidebar="false">
 <apex:form >
  <br></br><br></br><br></br>
  <center>
  <b> Select Faculty </b>
  <apex:inputField value="{!tt.Faculty_Name__c}"/><br></br><br></br>
  <apex:commandButton value="Submit" action="{!submit}"/>
  </center>
  <br></br><br></br>
  <table border="1" align="center">
  <th>Periods</th>
  <th>Monday</th>
  <th>Tuesday</th>
  <th>Wednesday</th>
  <th>Thursday</th>
  <th>Friday</th>
  <th>Saturday</th>
   <apex:repeat value="{!maplist}" var="key">
   <tr>
   <td>{!key}</td>
   <apex:repeat value="{!maplist[key]}" var="value">
   <td>{!value}</td>
   </apex:repeat>
   </tr>
   </apex:repeat>
  </table>
 </apex:form>
</apex:page>

Controller: 

public class FacultyTimeTable_con {

  public time_table__c tt {get; set;}
  public list<time_table__c> ttlist {get; set;}
  public map<string,list<string>> maplist {get; set;}
  
  public FacultyTimeTable_con()
  {
    tt = new time_table__c(); 
  }
  
  public void submit()
  {
    maplist = new map<string,list<string>>();
    
    ttlist = [select name, day__c, time1__r.period__c, time2__r.period__c, 
              time1__r.name, time2__r.name, faculty_name__r.name from time_table__c 
              where faculty_name__c = :tt.faculty_name__c];
              
    for(time_table__c t : ttlist)
    {
       if(!maplist.containskey(t.time1__r.period__c))
         maplist.put(t.time1__r.period__c,new list<string>());
         maplist.get(t.time1__r.period__c).add(t.time1__r.name);
         
       if(!maplist.containskey(t.time2__r.period__c))
         maplist.put(t.time2__r.period__c,new list<string>());
         maplist.get(t.time2__r.period__c).add(t.time2__r.name);  
    }
  }
}
Hi, 

I am trying to display a summary table using apex:repeat. However, I am not getting the query right. Any help is appreciated. Below is my code.

Object: Time_Table__c  
Fields:  Class__c  --- lookup
             Time__c   --- lookup
             Day__c    --- picklist
             faculty_name__c  --- lookup
 
VF Page:
<apex:page controller="facultydetails_con" sidebar="false" >
<apex:form >
<center>
 <br></br><br></br>
  <b>Select Faculty </b>
  <apex:inputfield value="{!faculty.Faculty_Name__c}"/><br></br><br></br>
  <apex:commandButton value="Submit" action="{!submit}"/>  
  <apex:pageBlock >
   <apex:pageblockSection >
    <apex:repeat value="{!fd}" var="item">
     <apex:outputText value="{!item.Class__c}" />
    </apex:repeat>
   </apex:pageblockSection>
  </apex:pageBlock>
</center> 
</apex:form> 
</apex:page>

Controller:
 
public class facultydetails_con {

   public time_table__c faculty {get; set;}
   public list<time_table__c> fd {get; set;}
   
   public facultydetails_con()
   {
     list<time_table__c> fd = new list<time_table__c>();
   }
   public pagereference submit()
   {
    fd = [select class__c, day__c, faculty_name__c from time_table__c where faculty_name__c = :faculty.faculty_name__c];
    return null;
   }
}

Thank you,
Satya
Hi,

I am trying to do a search on custom object Department__c through standard 'Name' field. However, I am unable to retrieve multiple records and only the Name field is being retrieved. Any help is appreciated. 

VF Page:

<apex:page controller="searchdept_con" showHeader="false">
 <apex:form >
  <apex:pageBlock >
   <apex:pageBlockSection Title="Search Department">
      Enter Department Name<apex:inputtext value="{!sd}"/>
      <apex:commandButton value="Find" action="{!searchdept}"/> 
  </apex:pageBlockSection>
  <apex:pageBlockSection title="Department Details" columns="1">  
     <apex:outputField value="{!dept.name}"/>
     <apex:outputField value="{!dept.Phone__c}"/>
     <apex:outputField value="{!dept.Email__c}"/>
     <apex:outputField value="{!dept.Comments__c}"/>
  </apex:pageBlockSection>
  </apex:pageBlock>
 </apex:form>
</apex:page>

Controller:

public class searchdept_con {

  public string sd { get; set; }
  public department__c dept { get; set; }
  
  public pagereference searchdept()
  {
    string qry = 'select id, name, phone__c, email__c, comments__c from department__c ' + 'where name like \'%'+sd+'%\' ';
    dept = database.query(qry);
    return null;
  }
}

Thank you.
Satya
Hi,

I need to refresh the whole VF Page once my delete method executes. I have wriiten the below code. When I delete a particular record, the record is getting deleted but the page is not refreshing to show the updated records. Please help. 

VF Page:

<apex:page controller="viewdept_con" showHeader="false " id="mypage">
 <apex:form >
  <apex:pageBlock >
   <apex:pageblockTable value="{!deptlist}" var="item"> 
     <apex:column headerValue="Action">
     <apex:commandLink value="Detail" action="{!deptdetail}"/><b> | </b>
     <apex:commandLink value="Del" action="{!deptdelete}" reRender="mypage">
     <apex:param name="deptid" value="{!item.id}" assignTo="{!deptid}"/>
     </apex:commandlink>
     </apex:column>
     <apex:column value="{!item.name}"/>
   </apex:pageblockTable>
  </apex:pageBlock>
 </apex:form>
</apex:page>

Controller:

public class viewdept_con {

   public list<department__c> deptlist { get; set; }
   public id deptid {get; set;}
   public department__c dept {get; set;}
   
   public viewdept_con()
   {
   deptlist = [select id, name from department__c];
   }
   
   public pagereference deptdetail()
   {
     pagereference pg = new pagereference('/apex/DepartmentDetail?deptid=' + deptid);
     return pg;
   }
   
   public pagereference deptdelete()
   {
     dept = [select id, name from department__c where id = :deptid];
     delete dept;
     return null;
   }
}

Thank you,
Satya
Hi All,

I am trying to display the case records that are closed on a particular date in VF Page. My inputfield does not allow me to select the closed date. Below is my code. Any help is appreciated. 

VF Page:

<apex:page controller="caseclosedetails" showHeader="false">
  <apex:form >
    <apex:pageblock >
      <apex:inputField value="{!ca.closeddate}" />
      <apex:commandButton value="Submit" action="{!getdata}"/>
    </apex:pageblock>
  </apex:form>
</apex:page>

Controller: 

public class caseclosedetails {

      public case ca {get; set;}
      
      public caseclosedetails() {
      case c = new case();  
      }
    
      public void getdata(){
      
      }
}

Thank you,
Satya
Hi, 

I am trying to display the account record details as well as the related contacts and opportunities for a selected account record through lookup.
I am stuck at the point where I am unable to obtain the record id for the selected account record.
Below is my code. Any help is appreciated. 

VF Page:

<apex:page controller="accountdisplay">
    <apex:form>
        <apex:pageBlock title="Display Account Details">
            <apex:outputText value="Select Account: " />
            <apex:inputField value="{!con.accountid}"/>
            <apex:commandButton action = "{!getdetails}" value='Submit' />
            <apex:pageBlockSection title="Account Details">
                <apex:outputtext value="{!acc.name}" />
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:

public class AccountDisplay {

    public account acc {get; set;}
    public contact con {get; set;}
        
    public pagereference getdetails(){
        acc = [select id, name from account where id = :con.AccountId]; 
        return null;
    }
}

Thank You,
Satya
Hi, 

I am trying to display the account details ( name, address, phone ) for the account selected in picklist. I have written the code for picklist as below. Any help is appreciated. 

<apex:page Controller="accountcontroller" showHeader="false">
    <apex:form>
        <apex:pageBlock title="Display Account Details: ">
            
            <apex:pageBlockSection>
            <apex:outputLabel value="Account Name: " />
            
            <apex:selectlist value="{!accid}" size="1" >
                <apex:selectOptions value="{!accountnames}" />
                <apex:actionSupport event="onchange" rerender = "display"/>
            </apex:selectlist>
            </apex:pageBlockSection>
            
        <apex:pageBlockSection title = 'Account Details'>
            
        </apex:pageBlockSection>    
            
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller 

public class accountcontroller {

    public string accid {get; set;}
    
    public list<selectoption> getaccountnames() {
        
        list<selectoption> accoptions = new list<selectoption>();
        for (account acc : [select id, name from account]){
            accoptions.add(new selectoption(acc.id, acc.name));
        }  
        return accoptions;
    } 
}

Thank you,
Satya
Hi,

I am trying to create a formula field 'Total__c' which has a return type of number. The formula will calculate the sum total value of seven other fields (subject1 marks, subject2 marks ... etc) which are of text type. However, if a student is absent for subject4, the value entered in subject4 field will be 'Absent' and this should be treated as zero while calculating the Total__c. I have written the below formula, but an error pops up saying the character length is too high. Any help is appreciated. 

IF(!ISNUMBER(English__c),0,Value(English__c))+IF(!ISNUMBER(Physics__c),0,Value(Physics__c))+ IF(!ISNUMBER(Maths__c),0,Value(Maths__c))+IF(!ISNUMBER(Chemistry__c),0,Value(Chemistry__c))+ 
IF(!ISNUMBER(Social__c),0,Value(Social__c))+IF(!ISNUMBER(Biology__c),0,Value(Biology__c))+
IF(!ISNUMBER(Economics__c),0,Value(Economics__c))

Thank you,
Satya
Hello All,

I am trying to create a formula field called 'Grade__c' with return type text. Based on the Total Marks (Total__c, return type is number), the grade field should be populated with either A+, A, B+, B, C and D. Say for example, the total marks are 600 0ut of 800, then the grade should be B. Can anyone help me out with this. 

Thank you,
Satya
Hello Everyone, 

I would like to strip the time of the dynamically referenced date field as shown below. Any help is appreciated. 

Controller: 

public class examschedule1_con {

   public exam_schedule__c es {get; set;}
   public list<exam_schedule__c> ess {get; set;}
   public map<string,list<date>> maplist{get; set;}
   
   public examschedule1_con()
   {
     es = new exam_schedule__c();
   }
   
   public void getdata()
   {
     maplist = new map<string,list<date>>();
     
     ess = [select name, startdate__c, enddate__c, starttime__c, endtime__c, year__c, examtype__c, 
           subject1__c, subject2__c, subject3__c, subject4__c, subject5__c, subject6__c, subject7__c 
           from exam_schedule__c where year__c = :es.year__c ];
           
     for(exam_schedule__c e : ess)
     {
        if(!maplist.containskey(e.examtype__c))
        maplist.put(e.examtype__c,new list<date>());
        maplist.get(e.examtype__c).add(e.subject1__c);
        maplist.get(e.examtype__c).add(e.subject2__c);
        maplist.get(e.examtype__c).add(e.subject3__c);
        maplist.get(e.examtype__c).add(e.subject4__c);
        maplist.get(e.examtype__c).add(e.subject5__c);
        maplist.get(e.examtype__c).add(e.subject6__c);
        maplist.get(e.examtype__c).add(e.subject7__c);
     }
   } 
}

VF Page: 

<apex:page controller="examschedule1_con" showHeader="false">
 <apex:form >
  <apex:pageBlock >
   <apex:pageblockSection title="Enter Exam Details">
    <apex:inputfield value="{!es.Year__c}"/>
    <apex:commandButton value="Submit" action="{!getdata}"/>
   </apex:pageblocksection>
  </apex:pageblock>  
  <table border="1" width="600" align="center">
  <th>Exam Type</th>
  <th>Subject1</th>
  <th>Subject2</th>
  <th>Subject3</th>
  <th>Subject4</th>
  <th>Subject5</th>
  <th>Subject6</th>
  <th>Subject7</th>
  <apex:repeat value="{!maplist}" var="key">
  <tr>
  <td>{!key}</td>
  <apex:repeat value="{!maplist[key]}" var="value">
  <td>{!value}</td>
  </apex:repeat>
  </tr>
  </apex:repeat>
  </table>
 </apex:form>
</apex:page>

My Output: 

User-added image

Thank you,
Satya
Hi All,

I have two custom field's of text datatype (Start_Time__c and End_Time__c). I want to put a validation rule so that the start time is always less than end time. Does anyone know how to proceed with this. 

Thank you,
Satya
Hi, 

I am trying to display a summary table using apex:repeat. However, I am not getting the query right. Any help is appreciated. Below is my code.

Object: Time_Table__c  
Fields:  Class__c  --- lookup
             Time__c   --- lookup
             Day__c    --- picklist
             faculty_name__c  --- lookup
 
VF Page:
<apex:page controller="facultydetails_con" sidebar="false" >
<apex:form >
<center>
 <br></br><br></br>
  <b>Select Faculty </b>
  <apex:inputfield value="{!faculty.Faculty_Name__c}"/><br></br><br></br>
  <apex:commandButton value="Submit" action="{!submit}"/>  
  <apex:pageBlock >
   <apex:pageblockSection >
    <apex:repeat value="{!fd}" var="item">
     <apex:outputText value="{!item.Class__c}" />
    </apex:repeat>
   </apex:pageblockSection>
  </apex:pageBlock>
</center> 
</apex:form> 
</apex:page>

Controller:
 
public class facultydetails_con {

   public time_table__c faculty {get; set;}
   public list<time_table__c> fd {get; set;}
   
   public facultydetails_con()
   {
     list<time_table__c> fd = new list<time_table__c>();
   }
   public pagereference submit()
   {
    fd = [select class__c, day__c, faculty_name__c from time_table__c where faculty_name__c = :faculty.faculty_name__c];
    return null;
   }
}

Thank you,
Satya
I was trying to input record in my custom object's custom field
Custom Object Merchandise (API Merchandise__c)
Custom Field(API i guess will be Price__c)
VF page :
<apex:page controller="InsertMerchandise">
  <apex:form >
 <apex:inputtext value="{!Name}"/> 
 <apex:inputtext value="{!mer.Price__c}"/>  
  <apex:commandButton id="Save" value="Save" action="{!Save}"/>
  </apex:form>
</apex:page><apex:page controller="InsertMerchandise">
  <apex:form >
 <apex:inputtext value="{!Name}"/> 
 <apex:inputtext value="{!mer.Price__c}"/> 
  <apex:commandButton id="Save" value="Save" action="{!Save}"/>
   </apex:form></apex:page>

Controller :
public class InsertMerchandise {
public Merchandise__c mer { get; set; }
    public Merchandise__c Price__c {get;set;}
//private Apexpages.StandardController controller; 
    public String Name { get; set; }
    public void Save() {
    mer = new Merchandise__c();
     mer.Name = Name;// 'test_p';
    mer.Price__c = Price__c;
 insert mer;}}
But its giving error . Can you please suggest I was trying to input record in my custom object's custom field
Custom Object Merchandise (API Merchandise__c)
Custom Field(API i guess will be Price__c)
VF page :
<apex:page controller="InsertMerchandise">
  <apex:form >
 <apex:inputtext value="{!Name}"/> 
 <apex:inputtext value="{!mer.Price__c}"/>  
  <apex:commandButton id="Save" value="Save" action="{!Save}"/>
  </apex:form>
</apex:page><apex:page controller="InsertMerchandise">
  <apex:form >
 <apex:inputtext value="{!Name}"/> 
 <apex:inputtext value="{!mer.Price__c}"/> 
  <apex:commandButton id="Save" value="Save" action="{!Save}"/>
   </apex:form></apex:page>

Controller :
public class InsertMerchandise {
public Merchandise__c mer { get; set; }
    public Merchandise__c Price__c {get;set;}
//private Apexpages.StandardController controller; 
    public String Name { get; set; }
    public void Save() {
    mer = new Merchandise__c();
     mer.Name = Name;// 'test_p';
    mer.Price__c = Price__c;
 insert mer;}}
But its giving error . Can you please suggest 
Hi,

I am trying to do a search on custom object Department__c through standard 'Name' field. However, I am unable to retrieve multiple records and only the Name field is being retrieved. Any help is appreciated. 

VF Page:

<apex:page controller="searchdept_con" showHeader="false">
 <apex:form >
  <apex:pageBlock >
   <apex:pageBlockSection Title="Search Department">
      Enter Department Name<apex:inputtext value="{!sd}"/>
      <apex:commandButton value="Find" action="{!searchdept}"/> 
  </apex:pageBlockSection>
  <apex:pageBlockSection title="Department Details" columns="1">  
     <apex:outputField value="{!dept.name}"/>
     <apex:outputField value="{!dept.Phone__c}"/>
     <apex:outputField value="{!dept.Email__c}"/>
     <apex:outputField value="{!dept.Comments__c}"/>
  </apex:pageBlockSection>
  </apex:pageBlock>
 </apex:form>
</apex:page>

Controller:

public class searchdept_con {

  public string sd { get; set; }
  public department__c dept { get; set; }
  
  public pagereference searchdept()
  {
    string qry = 'select id, name, phone__c, email__c, comments__c from department__c ' + 'where name like \'%'+sd+'%\' ';
    dept = database.query(qry);
    return null;
  }
}

Thank you.
Satya
Hi,

I need to refresh the whole VF Page once my delete method executes. I have wriiten the below code. When I delete a particular record, the record is getting deleted but the page is not refreshing to show the updated records. Please help. 

VF Page:

<apex:page controller="viewdept_con" showHeader="false " id="mypage">
 <apex:form >
  <apex:pageBlock >
   <apex:pageblockTable value="{!deptlist}" var="item"> 
     <apex:column headerValue="Action">
     <apex:commandLink value="Detail" action="{!deptdetail}"/><b> | </b>
     <apex:commandLink value="Del" action="{!deptdelete}" reRender="mypage">
     <apex:param name="deptid" value="{!item.id}" assignTo="{!deptid}"/>
     </apex:commandlink>
     </apex:column>
     <apex:column value="{!item.name}"/>
   </apex:pageblockTable>
  </apex:pageBlock>
 </apex:form>
</apex:page>

Controller:

public class viewdept_con {

   public list<department__c> deptlist { get; set; }
   public id deptid {get; set;}
   public department__c dept {get; set;}
   
   public viewdept_con()
   {
   deptlist = [select id, name from department__c];
   }
   
   public pagereference deptdetail()
   {
     pagereference pg = new pagereference('/apex/DepartmentDetail?deptid=' + deptid);
     return pg;
   }
   
   public pagereference deptdelete()
   {
     dept = [select id, name from department__c where id = :deptid];
     delete dept;
     return null;
   }
}

Thank you,
Satya
Hi All,

I am trying to display the case records that are closed on a particular date in VF Page. My inputfield does not allow me to select the closed date. Below is my code. Any help is appreciated. 

VF Page:

<apex:page controller="caseclosedetails" showHeader="false">
  <apex:form >
    <apex:pageblock >
      <apex:inputField value="{!ca.closeddate}" />
      <apex:commandButton value="Submit" action="{!getdata}"/>
    </apex:pageblock>
  </apex:form>
</apex:page>

Controller: 

public class caseclosedetails {

      public case ca {get; set;}
      
      public caseclosedetails() {
      case c = new case();  
      }
    
      public void getdata(){
      
      }
}

Thank you,
Satya
Hi, 

I am trying to display the account record details as well as the related contacts and opportunities for a selected account record through lookup.
I am stuck at the point where I am unable to obtain the record id for the selected account record.
Below is my code. Any help is appreciated. 

VF Page:

<apex:page controller="accountdisplay">
    <apex:form>
        <apex:pageBlock title="Display Account Details">
            <apex:outputText value="Select Account: " />
            <apex:inputField value="{!con.accountid}"/>
            <apex:commandButton action = "{!getdetails}" value='Submit' />
            <apex:pageBlockSection title="Account Details">
                <apex:outputtext value="{!acc.name}" />
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:

public class AccountDisplay {

    public account acc {get; set;}
    public contact con {get; set;}
        
    public pagereference getdetails(){
        acc = [select id, name from account where id = :con.AccountId]; 
        return null;
    }
}

Thank You,
Satya
Hi, 

I am trying to display the account details ( name, address, phone ) for the account selected in picklist. I have written the code for picklist as below. Any help is appreciated. 

<apex:page Controller="accountcontroller" showHeader="false">
    <apex:form>
        <apex:pageBlock title="Display Account Details: ">
            
            <apex:pageBlockSection>
            <apex:outputLabel value="Account Name: " />
            
            <apex:selectlist value="{!accid}" size="1" >
                <apex:selectOptions value="{!accountnames}" />
                <apex:actionSupport event="onchange" rerender = "display"/>
            </apex:selectlist>
            </apex:pageBlockSection>
            
        <apex:pageBlockSection title = 'Account Details'>
            
        </apex:pageBlockSection>    
            
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller 

public class accountcontroller {

    public string accid {get; set;}
    
    public list<selectoption> getaccountnames() {
        
        list<selectoption> accoptions = new list<selectoption>();
        for (account acc : [select id, name from account]){
            accoptions.add(new selectoption(acc.id, acc.name));
        }  
        return accoptions;
    } 
}

Thank you,
Satya