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

how to build empty table in vf & need to insert values into that table (manually)

how to build empty table in vf & need to insert values into that table (manually)

Eugene PozniakEugene Pozniak

If you are going to create new sObject using values of the table, use following as example:



public class emptyTableController {
	public yourSObject fakeSObject { get; set; }
	public emptyTableController() {
		fakeSObject = new yourSObject();



<apex:page controller="emptyTableController">
			<apex:pageBlockSection columns="enterYourSize">
					<apex:inputField value="fakeSObject.APIFieldName" />
				<!-- Repeat for all fields that you need -->


 If this table will not contain fields of sObject, use attributes like: <apex:inputText />, <apex:inputHidden />. For more detail read documentation about Standard Component Reference.

Chamil MadusankaChamil Madusanka

Are you looking for as follow approach? Try this solution.


<apex:page controller="manageScheduleController2" >
    <apex:form >
        <apex:pageBlock id="result">
            <apex:pageBlockTable value="{!ContactList}" var="con">
                 <apex:column value="{!con.Email}"/>
            <apex:column value="{!con.Account}"/>
                <apex:column value="{!con.Description}"/>
                <apex:column value="{!con.Phone}"/>
        <apex:commandButton value="Add Contact" action="{!addContact}" reRender="result"/>


public with sharing class manageScheduleController2{

    public List<Contact> ContactList { get; set; }
    public Contact cont{get;set;}

    public manageScheduleController2()
        ContactList = new List<Contact>();
    public void addContact()
       cont = new Contact();
       cont.Email = '';
       cont.Description = 'I\'m a Salesforce Developer';
       cont.Phone= '947777777777';




If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.