+ Start a Discussion
Force.platformForce.platform 

inputText component is not visiable in pageBlockTable

Hi all,
        my inputText component is not visible in column of pageBlockTable
vf:
<apex:page controller="Add_Participant_Page_Controller">
  <apex:form >
  <apex:pageBlock >
  <apex:commandButton title="Save Item" action="{!addItemWithoutParticipant}" value="Save Item"/>
  <apex:pageBlockTable value="{!addItem}" var="add">
  
  <apex:column headerValue="Item">
  <apex:inputText value="{!Name}" />
  </apex:column> 
  
  <apex:column headerValue="Quantity"> 
  <apex:inputText value="{!Quantity}"/>
  </apex:column>
  
  <apex:column headerValue="Rate"> 
  <apex:inputText value="{!Rate}"/>
  </apex:column>
  
  </apex:pageBlockTable>
  
  </apex:pageBlock>
  </apex:form>
</apex:page>
Controller:
public class Add_Participant_Page_Controller{

public List<Menu_Item__c> addItem{get; set;} 
public Integer Quantity{get; set;}
public String Name{get; set;}
public Integer Rate{get; set;}

 
 public pageReference addItemWithoutParticipant(){
  Menu_Item__c Item = new Menu_Item__c(Name=Name,Quantity__c=Quantity,Rate__c=Rate);
  addItem.add(Item);
  insert addItem ;
 return NULL;
 } 
}
David @ ConfigeroDavid @ Configero
in your Apex Controller you don't need the public properties for Quantity, Name, and Rate, so you can delete them.

In your Visualforce Page for each column's value specify {!add.Name} {!add.Quantity} and {!add.Rate} respectively.

You also might want to query for the Menu_Item__c records on initializing the page, and perhaps look into doing partial reRender with Visualforce.

This should fix your issue.

Please mark this as the correct answer if it helped!
Prashant Pandey07Prashant Pandey07
Hi,
I was looking into your code and it seems you are trying to insert a record from the visualforce page. You don't have to use page block table since you not displaying anything from the controller. You may use below code and let me know if that helps you.
 
<apex:page controller="Add_Participant_Page_Controller">
 <apex:form >
  <apex:pageBlock >
  
  <apex:pageBlockButtons>
      
  <apex:commandButton title="Save Item" action="{!addItemWithoutParticipant}" value="Save Item"/>
  </apex:pageBlockButtons>
  
  <apex:pageBlockSection columns="1">
           
          <apex:outputLabel value="Name" for="theinput"/>
           <apex:inputText value="{!Name}" id="theinput"/>
                       
          <apex:outputLabel value="Quantity" for="theinputq"/>
           <apex:inputText value="{!Quantity}" id="theinputq"/>
                         
          <apex:outputLabel value="Rate" for="theinpute"/>
           <apex:inputText value="{!rate}" id="theinpute"/>
  
  </apex:pageBlockSection>
 
  </apex:pageBlock>
  </apex:form>
</apex:page>

Apex Code
 
public class Add_Participant_Page_Controller{

public Menu_Item__c addItem{get; set;} 
public Integer Quantity{get; set;}
public String Name{get; set;}
public Integer Rate{get; set;}

 
 public pageReference addItemWithoutParticipant(){
  Menu_Item__c Item = new Menu_Item__c(Name=Name,Quantity__c=Quantity,Rate__c=rate);
  insert Item ;
  
 return NULL;
 } 
}