You need to sign in to do that
Don't have an account?
Force.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;
}
}
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;
}
}
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!
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 Code