+ Start a Discussion

add text field

how to add a column to my table on a text field the user will fill the text field isnt bounded to any object and i want to transfer its data to controller
Phillip SouthernPhillip Southern
Hi, sounds like you want a text field to add to a table in visualforce for data input, but that text field is only relevant to the VF page and doesnt live on any object?

If thats the case, you need to create a wrapper class, which will be a class containing an object and then custom parameters with it like a boolean field for selecting it or text field for data input.  Here is a great reference and example regarding  wrapper classes:


Vamsi KrishnaVamsi Krishna
you can use the apex:inputText tag for this..
usually inputField is used to map to an object field thats stored in salesforce and inputText is used to map to a controller variable which is not persisted in an object..

check this link for more details on apex:inputText
Chandra PrakashChandra Prakash
Hi ,
 please check below code if this code help full for you..

<apex:page standardController="Employe_bisp__c" sidebar="false">
<apex:form >
<apex:pageblock >
<apex:dataTable value="{!Employe_bisp__c}" var="emp1" border="2">
<apex:column >
  <apex:facet name="header">Name</apex:facet>
  <apex:inputField value="{!emp1.name}"  id="a1"/>
<apex:column >
  <apex:facet name="header">Employee Salary</apex:facet>
     <apex:inputField value="{!emp1.Salary__c}" id="a2"/>
<apex:column >
<apex:commandButton action="{!save}" value="Save"/>