+ Start a Discussion

Input Field in VFPage


Hello Friends,


I am giving this input value and i want to access it in class .I took one variable of id type (Because it is a look field)


<apex:inputField value="{!TmMembobj.HS_Codes__c}" id="teammem"  />

I took one variable of id type and passed the value in that.But is giving null




Any idea how to do the same????????????


Thanks in advance

The mechanism you are using to access is the correct one. You'll need to post some more of your code for us to help - for example, what type of controller this is, how you set up the TmMombobj variable etc.

<apex:page controller="Cls_SelectTeamMembers" id="pageId">
<apex:form >
<apex:sectionHeader subtitle="New Team Member" title="Team Member Edit"/>
<apex:pageBlock title="Team Member Edit" mode="edit">
<apex:pageblockbuttons >
<apex:commandbutton value="Save" action="{!savecat}"/>
<apex:commandbutton value="Cancel" />
<apex:outputPanel >
<apex:pageBlockSection title="Information" columns="2">

<apex:param name="q" value="{!TmMembobj.HS_Site_Codes__c}"/><br/>
<apex:inputField value="{!TmMembobj.HS_Codes__c}" id="teammem" />

<apex:pageBlockSection id="pbs">
<apex:selectList value="{!lst}" multiselect="true" label="Select Employees">
<apex:selectOptions value="{! Empoplist1}"/>


public class Cls_SelectTeamMembers {
public list<Employee__c> Emplist1{get;set;}
public list<Employee__c> Emplist2{get;set;}
public List<SelectOption> Empoplist1{get; set;}
public List<SelectOption> Empoplist2{get; set;}
public List<Team_Member__c> TeamMemberList1{get; set;}
public List<Team_Member__c> TeamMemberList2{get; set;}
public Team_Member__c TmMembobj{get; set;}
public id ConId{get;set;}
public id HSId{get;set;}
public List<String> lst{get;set;}
public List<String> lst1{get;set;}
public Boolean refreshPage {get; set;}
public List<String> lstSelected {get; set;}
public List<ID> totallid{get;set;}
public List<ID> existingTeam = new List<ID>();
public List<ID> empid = new List<ID>();
public set<id> EMPIDS=new set<id>();
public Cls_SelectTeamMembers() {

Emplist1=new list<Employee__c>();
Emplist2=new list<Employee__c>();
TeamMemberList1= new List<Team_Member__c>();
TeamMemberList2= new List<Team_Member__c>();
lst=new List<String>();
lst1=new List<String>();
lstSelected =new List<String>();
totallid=new List<ID>();
existingTeam =new List<ID>();
empid=new List<ID>();
Emplist1=[select id,name from Employee__c ];
Empoplist1=new List<SelectOption>();

system.debug('##############'+ Emplist1);
For(Employee__c emp:Emplist1)
Empoplist1.add(new SelectOption(emp.id,emp.name));
system.debug('eeeeeeeeeeeee'+ Empoplist1);


public pageReference savecat()

// system.debug('ttttttttttttttt'+ TmMembobj.HS_Site_Codes__c);

for(ID tid:lst)
system.debug('lllllllllllllll'+ lst);

integer i;
for(ID oid:totallid)

Team_Member__c obj =new Team_Member__c();
//here i want to give hs code


insert TeamMemberList2;

return null;


You haven't instantiated the TmMembobj variable, so this will be null.